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 integer
n(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
题目大意:
给你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);
}
}