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
output
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
output
View Code
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
相关文章推荐
- 1101. Quick Sort (25)
- ps中的用法,切图抠图
- 电影入侵电竞圈,这是要为浮躁添把柴?
- 《Linux重要基础命令回顾复习》
- NetLogo编程的几个小技巧
- iOS开发-------初探运行时runtime
- ORACLE多表关联UPDATE 语句
- C++学习笔记:友元函数和友元类
- 用the silver searcher与alfred从一堆文件中快速查找信息
- 基于Javascript实现倒计时功能
- goto语句学习的实例
- 海量数据处理10题
- 用 ISNULL(), NVL(), IFNULL() and COALESCE() 函数替换空值
- 前端文章收集
- linux g++编译提示少pthread库
- 最小(大)表示法习题 -- 来自[kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher
- 利用for语句 + switch语句进行中奖判断和循环
- 查询两个日期(时间)以内的数据,between and 或 and 连>= <=,to_date()
- 安装用户脚本基本步骤
- Wireshark抓包实例分析HTTP问题