314

#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <string> #define NORTH 0 #define EAST 1 #define SOUTH 2 #define WEST 3 using namespace std; struct State{ int x,y,dir; int val; }; int r,c; int gr[55][55][4]; string face; int bx,by,ex,ey; void bfs() { int dir; queue<int> q; if(face=="south") dir=SOUTH; else if(face=="north") dir=NORTH; else if(face=="east") dir=EAST;

11970

#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <vector> #include <cstring> #include <cmath> #define ll long long using namespace std; vector<ll> v; int main() { int t; ll n,sq,sq_root,x; int kase=1; scanf("%d",&t); while(t–) { scanf("%lld",&n); sq=0; int k=0; v.clear(); for(ll i=0;;i++) { sq += 2*i+1; sq_root=i+1; if(sq>=n) break; x = n-sq; if(x%sq_root==0

12136

#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <cstring> #include <cmath> using namespace std; int main() { int t; int kase=1; int hr1,hr2,hr3,hr4; int t1,t2,t3,t4; int mn1,mn2,mn3,mn4; string str1,str2,str3,str4; scanf("%d",&t); while(t–) { cin>>str1>>str2; cin>>str3>>str4; hr1=hr2=hr3=hr4=0; mn1=mn2=mn3=mn4=0; hr1=str1[0]-'0';hr1*=10; hr1+=(str1[1]-'0'); hr2=str2[0]-'0';hr2*=10; hr2+=(str2[1]-'0'); hr3=str3[0]-'0';hr3*=10; hr3+=(str3[1]-'0'); hr4=str4[0]-'0';hr4*=10; hr4+=(str4[1]-'0'); mn1=str1[3]-'0';mn1*=10; mn1+=(str1[4]-'0'); mn2=str2[3]-'0';mn2*=10; mn2+=(str2[4]-'0'); mn3=str3[3]-'0';mn3*=10; mn3+=(str3[4]-'0'); mn4=str4[3]-'0';mn4*=10; mn4+=(str4[4]-'0');

298

#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <cstring> #include <cmath> using namespace std; bool gr[30][30][7][7]; //bool gr2D[30][30]; struct Point{ int x,y,velocity,accleration; int val; }; Point St,Fn; int m,n; void bfs() { int x,y,v,a,val; int dx,dy,tx,ty; queue<int> q; q.push(St.x);q.push(St.y); q.push(0);q.push(0);q.push(0); gr[St.x][St.y][0+3][0+3]=1; while(!q.empty()) { x=q.front();q.pop(); y=q.front();q.pop(); v=q.front();q.pop(); a=q.front();q.pop(); val = q.front();q.pop(); //cout<<x<<" "<<y<<"

11121

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <string> #include <vector> #include <cmath> #include <cstdlib> #define INF 1000000 #define ll long long using namespace std; int main() { int t,kase=1; ll n; int a=-2,b=-3; //cout<<a%2<<" "<<b%2<<"\n"; string str; scanf("%d",&t); while(t–) { scanf("%lld",&n); if(n==0) { printf("Case #%d: ",kase++); printf("0\n"); continue; } str=""; while(n) { if(n%2)

12459

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #include <fstream> #define INF 1000000 #define ll long long using namespace std; struct node{ ll female,male,sum; }; int main() { node fib[85]; fib[1].female=0; fib[1].male=1; fib[1].sum=1; fib[2].female=1; fib[2].male=1; fib[2].sum=2; for(int i=3;i<85;i++) { fib[i].female=fib[i-1].sum; fib[i].male=fib[i-1].female; fib[i].sum=fib[i].male+fib[i].female; } int n; while(scanf("%d",&n)) { if(n==0) break;

12468

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #define INF 1000000 #define ll long long using namespace std; int main() { int m,n,diff1,diff2; while(scanf("%d%d",&m,&n) && m!=-1 && n!=-1) { if(m==-1 && n==-1) break; diff1 = abs(m-n); if(diff1<=50) printf("%d\n",diff1); else printf("%d\n",100-diff1); } return 0; }  

12611

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #define INF 1000000 #define ll long long using namespace std; int main() { int t,kase=1; double r,len,width; double up_left_x,up_left_y,up_right_x,up_right_y,lo_right_x,lo_right_y,lo_left_x,lo_left_y; scanf("%d",&t); while(t–) { scanf("%lf",&r); len = r/.2; width = len*.6; up_left_x = (-len)*.45; up_left_y = width/2; up_right_x = (len)*.55; up_right_y = width/2;

11715

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #define INF 1000000 #define ll long long using namespace std; int main() { int kase=1; int n; double u,v,t,a,s; while(scanf("%d",&n),n) { if(n==1) { scanf("%lf%lf%lf",&u,&v,&t); a = (v-u)/t; s=u*t+.5*a*(t*t); printf("Case %d: %.3lf %.3lf\n",kase++,s,a); } else if(n==2) { scanf("%lf%lf%lf",&u,&v,&a); t = (v-u)/a; s=u*t+.5*a*(t*t);

11428

#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #define INF 1000000 #define ll long long using namespace std; struct node{ int x,y; }; node arr[10005]; int main() { int n,diff; int difference_arr[10005]; for(int i=2;i<61;i++) { for(int j=1;j<i;j++) { diff = i*i*i – j*j*j; if(diff>10001) continue; difference_arr=1; if(arr.x==0 || arr.y==0)