“玲珑杯”ACM比赛 Round #19 A.A simple math problem【打表找规律】
2017-07-29 17:22
507 查看
A -- A simple math problem
Time Limit:2s Memory Limit:128MByte
Submissions:1568Solved:262
DESCRIPTION
You have a sequence anan,
which satisfies:
Now you should find the value of
⌊10an⌋⌊10an⌋.
INPUT
The input includes multiple test cases. The number of test case is less than 1000.Each test case contains only one integern(1≤n≤109)n(1≤n≤109)。
OUTPUT
For each test case, print a line of one number which means the answer.
SAMPLE INPUT
5
20
1314
SAMPLE OUTPUT
5
21
1317
SOLUTION
“玲珑杯”ACM比赛 Round #19
题目大意:
给你N,让你求出10^(an)
思路:
显然其随着n的递增,值也会递增。
前期n和ans基本等同,后期会增加一些值,所以我们暴力本地打表,得知什么时候能够将ans+1即可。
Ac代码:
Time Limit:2s Memory Limit:128MByte
Submissions:1568Solved:262
DESCRIPTION
You have a sequence anan,
which satisfies:
Now you should find the value of
⌊10an⌋⌊10an⌋.
INPUT
The input includes multiple test cases. The number of test case is less than 1000.Each test case contains only one integern(1≤n≤109)n(1≤n≤109)。
OUTPUT
For each test case, print a line of one number which means the answer.
SAMPLE INPUT
5
20
1314
SAMPLE OUTPUT
5
21
1317
SOLUTION
“玲珑杯”ACM比赛 Round #19
题目大意:
给你N,让你求出10^(an)
思路:
显然其随着n的递增,值也会递增。
前期n和ans基本等同,后期会增加一些值,所以我们暴力本地打表,得知什么时候能够将ans+1即可。
Ac代码:
#include<stdio.h> #include<string.h> using namespace std; #define ll long long int ll F[15]={11,100,999,9998,99997,999996,9999995,99999994,999999993}; int main() { ll n; while(~scanf("%lld",&n)) { ll output=n; for(int i=0;i<=8;i++) { if(n>=F[i])output++; } printf("%lld\n",output); } }
相关文章推荐
- “玲珑杯”#19 A -- A simple math problem 找规律
- “玲珑杯”ACM比赛 Round #19题解&源码【A,规律,B,二分,C,牛顿迭代法,D,平衡树,E,概率dp】
- A simple math problem【打表找规律】
- lonlifeOJ1152 “玲珑杯”ACM比赛 Round #19 概率DP
- 玲珑杯”ACM比赛 Round #19 B 维护单调栈
- “玲珑杯”ACM比赛 Round #19 B(RMQ大法好啊,比线段树快得多!!!!)
- hdu 4979 A simple math problem. DLX(多重覆盖)+打表
- hdu - 4979 - A simple math problem.(可反复覆盖DLX + 打表)
- hdu - 4979 - A simple math problem.(可重复覆盖DLX + 打表)
- “玲珑杯”ACM比赛 Round #18 B -- 数论你还会快速幂【规律】
- hdu4979 A simple math problem.Dancing Links,打表
- “玲珑杯”ACM比赛 Round #19 E.Expected value of the expression【Dp】
- ACM-ICPC Asia Regional Contest HDU 5974 A Simple Math Problem(数论)
- “玲珑杯”ACM比赛 Round #19 B.Buildings【二分+RMQ】
- 2016ACM/ICPC亚洲区大连站 D - A Simple Math Problem(尚未通过)
- hihoCode 1249 A Math Problem ACM/ICPC 2015 Beijing (数位dp+规律)
- 2016大连ACM D.ASimple Math Problem
- “玲珑杯”ACM比赛 Round #19 B -- Buildings (RMQ + 二分)
- “玲珑杯”ACM比赛 Round #19
- HDOJ 1757 A Simple Math Problem