Pagini recente » Cod sursa (job #1655193) | Cod sursa (job #2496881) | Cod sursa (job #2967270) | Cod sursa (job #1891550) | Cod sursa (job #466226)
Cod sursa(job #466226)
#include<stdio.h>
#include<math.h>
//#define cond c == 1 || c == 2 || c==3||c==5||c==8||c==13||c==21||c==34||c==55||89||c==144||c==233||c==377||c==610||c==987||c==1597||c==2584||c==4181||c==6765
FILE*f=fopen("fibo3.in","r");
FILE*g=fopen("fibo3.out","w");
int n,xx,xxx,yy,yyy,i,j,nr,ii;
long long c;
int cond(int c){
if(c == 1 || c == 2 || c==3||c==5||c==8||c==13||c==21||c==34||c==55||c==89||c==144||c==233||c==377||c==610||c==987||c==1597||c==2584||c==4181||c==6765)
return 1;
return 0;
}
int main () {
fscanf(f,"%d",&n);
for ( ii = 1 ; ii <= n ; ++ii ){
fscanf(f,"%d %d %d %d",&xx,&yy,&xxx,&yyy);
nr = 0 ;
for ( i = xx; i <= xxx ; ++i )
for ( j = yy ; j <= yyy; ++j ){
c = i + j;
if ( cond(c) )
++nr;
}
fprintf(g,"%d\n",nr);
}
fclose(f);
fclose(g);
return 0;
}