codeforcesExperimental Educational Round: VolBIT Formulas Blitz
来源:互联网 发布:淘宝店铺利益点写什么 编辑:程序博客网 时间:2024/05/08 11:27
#include<cstdio> #include<cstdlib> #include<cstring> using namespace std; long long pow(long long a,long long b,long long c){ if(b==0)return 1%c; long long t=pow(a,b>>1,c); t=t*t%c; if(b&1)t=t*a%c; return t; }int main(){long long n;while(scanf("%I64d",&n)!=EOF){if(n==1){printf("5\n");}else {printf("25\n");}}return 0;}
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std; int main(){double n,t;while(scanf("%lf%lf",&n,&t)!=EOF){printf("%.10lf\n",n*pow(1.000000011,t));}return 0;}
The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.
Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office given that a door-plate can hold a number not longer than n digits.
The only line of input contains one integer n (1 ≤ n ≤ 55) — the maximum length of a number that a door-plate can hold.
Output one integer — the maximum number of offices, than can have unique lucky numbers not longer than n digits.
2
6
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std; int main(){long long n;while(scanf("%I64d",&n)!=EOF){long long ans=0;for(long long i=1;i<=n;++i){ans=ans+((1ll)<<i);}printf("%I64d\n",ans);}return 0;}
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std; int main(){long long n;while(scanf("%I64d",&n)!=EOF){if(n==0){printf("1\n");}else {//n--;printf("%I64d\n",(6+6*n)*n/2+1);}}return 0;}
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long D[maxn]; long long C[maxn][maxn]; void init(){ D[1]=0;D[2]=1; for(int i=0;i<maxn;++i){ C[i][i]=C[i][0]=1; if(i>2){ D[i]=(i-1)*(D[i-1]+D[i-2]); } } for(int i=2;i<maxn;++i){ for(int j=1;j<i;++j){ C[i][j]=C[i-1][j]+C[i-1][j-1]; } } } int main(){init();long long n;while(scanf("%I64d",&n)!=EOF){long long ans=0;printf("%I64d\n",C[n][5]+C[n][6]+C[n][7]);}return 0;}
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.
A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.
The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.
Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.
3000
1
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long D[maxn]; long long C[maxn][maxn];int num[7257601]; int main(){long long n;while(scanf("%I64d",&n)!=EOF){printf("%I64d\n",n/2520);}return 0;}
There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.
The game is played on a square field consisting of n × n cells. Initially all cells are empty. On each turn a player chooses and paint an empty cell that has no common sides with previously painted cells. Adjacent corner of painted cells is allowed. On the next turn another player does the same, then the first one and so on. The player with no cells to paint on his turn loses.
The professor have chosen the field size n and allowed the student to choose to be the first or the second player in the game. What should the student choose to win the game? Both players play optimally.
The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the size of the field.
Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number 2.
1
1
2
2
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long D[maxn]; long long C[maxn][maxn];int num[7257601]; int main(){long long n;while(scanf("%I64d",&n)!=EOF){if(n&1)printf("1\n");else printf("2\n"); }return 0;}
The Department of economic development of IT City created a model of city development till year 2100.
To prepare report about growth perspectives it is required to get growth estimates from the model.
To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots.
The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one.
The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation.
In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6.
1 30 200
-10.000000000000000-20.000000000000000
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long D[maxn]; long long C[maxn][maxn];int num[7257601]; int main(){long long n;double a,b,c;while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF){double d=sqrt(b*b-4.0*a*c);double x1=(-b+d)/(2.0*a);double x2=(-b-d)/(2.0*a);if(x1>x2){printf("%.6lf\n%.6lf\n",x1,x2);}else printf("%.6lf\n%.6lf\n",x2,x1);}return 0;}
The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections.
The city funded purchase of five benches. To make it seems that there are many benches it was decided to place them on as many paths as possible. Obviously this requirement is satisfied by the following scheme: each bench is placed on a cross of paths and each path contains not more than one bench.
Help the park administration count the number of ways to place the benches.
The only line of the input contains one integer n (5 ≤ n ≤ 100) — the number of east to west paths and north to south paths.
Output one integer — the number of ways to place the benches.
5
120
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long D[maxn]; long long C[maxn][maxn];int num[7257601]; int main(){long long n;double a,b,c;while(scanf("%I64d",&n)!=EOF){if(n==100){printf("680185280130048000\n");}else printf("%I64d\n",((n*n*(n-1)*(n-1))/4)*(((n-2)*(n-2)*(n-3)*(n-3))/2)*(n-4)*(n-4)/15);}return 0;}
The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation code arrives.
A young hacker Vasya disassembled the program and found the algorithm that transforms the shown number into the activation code.Note: it is clear that Vasya is a law-abiding hacker, and made it for a noble purpose — to show the developer the imperfection of their protection.
The found algorithm looks the following way. At first the digits of the number are shuffled in the following order <first digit><third digit><fifth digit><fourth digit><second digit>. For example the shuffle of 12345 should lead to 13542. On the second stage the number is raised to the fifth power. The result of the shuffle and exponentiation of the number 12345 is 455 422 043 125 550 171 232. The answer is the 5 last digits of this result. For the number 12345 the answer should be 71232.
Vasya is going to write a keygen program implementing this algorithm. Can you do the same?
The only line of the input contains a positive integer five digit number for which the activation code should be found.
Output exactly 5 digits without spaces between them — the found activation code of the program.
12345
71232
#include<cstdio> #include<cstdlib> #include<cstring>#include<cmath> using namespace std;const int maxn=1010;long long num[10]; int main(){long long n,cnt=0; while(scanf("%I64d",&n)!=EOF){cnt=5;while(n){num[cnt]=n%10;cnt--;n/=10;}n=num[2]+num[4]*10+num[5]*100+num[3]*1000+num[1]*10000;printf("%05I64d\n",(n*n%100000000*n%10000000*n%10000000*n%10000000)%100000);}return 0;}
IT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is not divisible by any number from 2 to 10 every developer of this game gets a small bonus.
A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.
The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.
Output one integer showing how many numbers from 1 to n are not divisible by any number from 2 to 10.
12
2
#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<cmath>#include<queue>#include<list>#include<vector>#include<map>using namespace std;int main(){long long n;while(~scanf("%I64d",&n)){printf("%I64d\n",n-n/2-n/3+n/6-n/5+n/10+n/15-n/7+n/14+n/21+n/35-n/30-n/42-n/70-n/105+n/210);}return 0;}
- codeforcesExperimental Educational Round: VolBIT Formulas Blitz
- Experimental Educational Round: VolBIT Formulas Blitz
- Experimental Educational Round: VolBIT Formulas Blitz题解
- Codeforces Experimental Educational Round: VolBIT Formulas Blitz D. Hexagons!
- Experimental Educational Round: VolBIT Formulas Blitz 公式题
- Experimental Educational Round: VolBIT Formulas Blitz(A)数学
- Experimental Educational Round: VolBIT Formulas Blitz(B)快速幂
- Experimental Educational Round: VolBIT Formulas Blitz(D)数学
- Experimental Educational Round: VolBIT Formulas Blitz(F)排列组合
- Experimental Educational Round: VolBIT Formulas Blitz(J)打表找规律
- Experimental Educational Round: VolBIT Formulas Blitz(R)博弈
- Experimental Educational Round: VolBIT Formulas Blitz(数学、组合数学)
- Experimental Educational Round: VolBIT Formulas Blitz-R. Game
- CodeForces Experimental Educational Round: VolBIT Formulas Blitz A. Again Twenty Five!
- Experimental Educational Round: VolBIT Formulas Blitz K. Indivisibility —— 容斥原理
- blitz
- Educational Codeforces Round 1
- Educational Codeforces Round 2
- Sqlite中存储Boolean和boolean对象,分别使用boolean和text类型
- 【解题报告】2014ACM/ICPC亚洲区北京站
- 通用excel数据导出/转换(二)
- 基于Weblogic 开发 JavaEE 需要的wlfullclient.jar的制作方法
- Java内部类详解
- codeforcesExperimental Educational Round: VolBIT Formulas Blitz
- 自动化测试之准备篇
- CoreBluetooth第二节:Performing Common Peripheral Role Task(执行常见的外设端任务)
- 深入理解Java的接口和抽象类
- 通过重写ViewGroup学习onMeasure()和onLayout()方法
- 在滑动listview时,部分item出现背景黑色
- 电脑不小心重启或死机,然后再打开android studio,所有方法都是红色的,没找到
- Leecode:Longest Common Prefix
- Animation中多段动画的连续播放