<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 const LL maxm=1e5+10; int main() { LL n; while(scanf("%I64d",&n)!=EOF) { printf("25\n"); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 int main() { double n,t; while(scanf("%lf%lf",&n,&t)!=EOF) { double x=pow(1.000000011,t)*n; printf("%f\n",x); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 const LL maxm=60; LL dp[maxm]; LL POW(LL n) { LL sum=1; for(LL i=1;i<=n;i++) { sum*=2; } return sum; } void Init() { dp[1]=2; for(LL i=2;i<=55;i++) { dp[i]=dp[i-1]+POW(i); } } int main() { LL n; Init(); while(scanf("%I64d",&n)!=EOF) { printf("%I64d\n",dp[n]); } return 0; }</span>
After a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known "Heroes of Might & Magic". A part of the game is turn-based fights of big squadrons of enemies on infinite fields where every cell is in form of a hexagon.
Some of magic effects are able to affect several field cells at once, cells that are situated not farther than n cells away from the cell in which the effect was applied. The distance between cells is the minimum number of cell border crosses on a path from one cell to another.
It is easy to see that the number of cells affected by a magic effect grows rapidly when n increases, so it can adversely affect the game performance. That's why Petya decided to write a program that can, given n, determine the number of cells that should be repainted after effect application, so that game designers can balance scale of the effects and the game performance. Help him to do it. Find the number of hexagons situated not farther than n cells away from a given cell.
The only line of the input contains one integer n (0 ≤ n ≤ 109).
Output one integer — the number of hexagons situated not farther than n cells away from a given cell.
2
19
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 LL POW(LL n) { LL sum=1; for(LL i=1;i<=3;i++) { sum*=n; } return sum; } int main() { LL n; while(scanf("%I64d",&n)!=EOF) { LL sum=POW(n+1)-POW(n); printf("%I64d\n",sum); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 LL C(LL m,LL n) { if(n>m) return 0; LL ans=1; for(LL i=1;i<=n;i++) { ans*=m+1-i; ans/=i; } return ans; } int main() { LL n; while(scanf("%I64d",&n)!=EOF) { LL sum=C(n,5)+C(n,6)+C(n,7); printf("%I64d\n",sum); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 LL C(LL m,LL n) { if(n>m) return 0; LL ans=1; for(LL i=1;i<=n;i++) { ans*=m+1-i; ans/=i; } return ans; } int main() { LL n; while(scanf("%I64d",&n)!=EOF) { LL sum=C(n+4,5)*C(n+2,3); printf("%I64d\n",sum); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 LL A(LL n,LL m) { LL ans=1; for(LL i=n;i>=(n-m+1);i--) { ans*=i; } return ans; } int main() { LL n; while(scanf("%I64d",&n)!=EOF) { LL sum=A(n,5)*(A(n,5)/120); printf("%I64d\n",sum); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 int main() { LL n; while(scanf("%I64d",&n)!=EOF) { LL x=n/2520; printf("%I64d\n",x); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<algorithm> using namespace std; #define LL __int64 int main() { LL n; while(scanf("%I64d",&n)!=EOF) { n-=(n/2+n/3+n/5+n/7-n/6-n/10-n/14-n/15-n/21-n/35+n/30+n/42+n/70+n/105-n/210); printf("%I64d\n",n); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<algorithm> using namespace std; #define LL __int64 string x; int main() { LL n; while(cin>>x) { n=(x[0]-'0')*10000+(x[1]-'0')+(x[2]-'0')*1000+(x[3]-'0')*10+(x[4]-'0')*100; LL ans=1; for(LL i=0;i<5;i++) { ans=ans*n%100000; } printf("%05I64d\n",ans); } return 0; }</span>
Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.
One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification?
But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical.
Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized.
Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum.
The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to "true up".
The next figure shows 90 degrees clockwise turn by FPGA hardware.
The only line of the input contains one integer x ( - 1018 ≤ x ≤ 1018) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise.
Output one integer — the minimum required number of 90 degrees clockwise turns.
60
1
-60
3
When the camera is rotated 60 degrees counter-clockwise (the second example), an image from it is rotated 60 degrees clockwise. One90 degrees clockwise turn of the image result in 150 degrees clockwise total rotation and deviation from "true up" for one turn is 150degrees. Two 90 degrees clockwise turns of the image result in 240 degrees clockwise total rotation and deviation from "true up" for two turns is 120 degrees because 240 degrees clockwise equal to 120 degrees counter-clockwise. Three 90 degrees clockwise turns of the image result in 330 degrees clockwise total rotation and deviation from "true up" for three turns is 30 degrees because 330 degrees clockwise equal to 30 degrees counter-clockwise.
From 60, 150, 120 and 30 degrees deviations the smallest is 30, and it it achieved in three 90 degrees clockwise turns.
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<algorithm> using namespace std; #define LL __int64 int main() { LL n; while(scanf("%I64d",&n)!=EOF) { n=(n%360+360)%360; if(n>=315) printf("0\n"); else printf("%I64d\n",n/90+(n%90-1)/45); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<math.h> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 int main() { double a,b,c; while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF) { double x1=(-b+sqrt(b*b-4*a*c))/(2*a); double x2=(-b-sqrt(b*b-4*a*c))/(2*a); if(x1>x2) printf("%0.6f\n%0.6f\n",x1,x2); else printf("%0.6f\n%0.6f\n",x2,x1); } return 0; }</span>
<span style="font-size:14px;">#include<stdio.h> #include<string.h> #include<string> #include<iostream> #include<map> #include<algorithm> using namespace std; #define LL __int64 int main() { LL n; while(scanf("%I64d",&n)!=EOF) { if(n&1) { printf("1\n"); } else { printf("2\n"); } } return 0; }</span>