結果
| 問題 | No.491 10^9+1と回文 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-10 22:56:08 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 21,760 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 08:30:13 |
| 合計ジャッジ時間 | 2,644 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 103 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld",&n);
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
const long long p=1000000001;
long long powten(long long n){
if(n<=0) return 1;
return powten(n-1)*10;
}
int main(int argc, char const *argv[]){
long long n,a,b,c;
scanf("%lld",&n);
a=n/p;
b=0;
c=0;
while(a>0){
b++;
a/=10;
}
for(a=1;a<b;a++){
c+=9*powten((a+1)/2-1);
}
while(n>0){
c+=(n/p/powten(b-1)-1)*powten((b+1)/2-1);
n-=n/p/powten(b-1)*(powten(b-1)+1);
b-=2;
n/=10;
}
printf("%lld\n",c);
return 0;
}