您的位置:首页 > 其它

cf-公式专场

2016-02-22 08:50 405 查看
A. Again Twenty Five!

time limit per test
0.5 seconds

memory limit per test
64 megabytes

input
standard input

output
standard output

The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" — the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using a calculator, but we need people who are able to think, not just follow the instructions."

Could you pass the interview in the machine vision company in IT City?

Input
The only line of the input contains a single integer n (2 ≤ n ≤ 2·1018) — the power in which you need to raise number 5.

Output
Output the last two digits of 5n without spaces between them.

Examples

input
2


output
25
题解:我用快速幂写了下,其实感觉都是25的;
代码:


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
LL n;
while(~scanf("%I64d",&n)){
int ans=1,k=5;
while(n){
if(n&1)ans=k*ans%100;
else k=k*k%100;
n>>=1;
}
printf("%d\n",ans);
}
return 0;
}


B. Moore's Law

time limit per test
0.5 seconds

memory limit per test
64 megabytes

input
standard input

output
standard output

The city administration of IT City decided to fix up a symbol of scientific and technical progress in the city's main square, namely an indicator board that shows the effect of Moore's law in real time.

Moore's law is the observation that the number of transistors in a dense integrated circuit doubles approximately every 24 months. The implication of Moore's law is that computer performance as function of time increases exponentially as well.

You are to prepare information that will change every second to display on the indicator board. Let's assume that every second the number of transistors increases exactly 1.000000011 times.

Input
The only line of the input contains a pair of integers n (1000 ≤ n ≤ 10 000) and t (0 ≤ t ≤ 2 000 000 000) — the number of transistors in the initial time and the number of seconds passed since the initial time.

Output
Output one number — the estimate of the number of transistors in a dence integrated circuit in t seconds since the initial time. The relative error of your answer should not be greater than 10 - 6.

Examples

input
1000 1000000


output
1011.060722383550382782399454922040
题解:
n*pow(1.000000011,t),我竟然还想着快速幂;
代码:


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
const int INF=0x3f3f3f3f;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define SD(x) scanf("%lf",&x)
#define P_ printf(" ")
typedef __int64 LL;
int main(){
double a,b,c;
while(~scanf("%lf%lf%lf",&a,&b,&c)){
double t=sqrt(b*b-4*a*c);
printf("%.15f\n%.15f\n",max((-b+t)/(2*a),(-b-t)/(2*a)),min((-b+t)/(2*a),(-b-t)/(2*a)));
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: