結果
| 問題 |
No.381 名声値を稼ごう Extra
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-25 19:19:32 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 1,345 ms |
| コンパイル使用メモリ | 29,696 KB |
| 実行使用メモリ | 10,408 KB |
| 最終ジャッジ日時 | 2024-12-29 06:41:19 |
| 合計ジャッジ時間 | 10,116 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 |
ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char s[1048576];
char a[1048576];
int main()
{
int alen,i,tmp,c,ans=0;
if(scanf("%1000001s",s)<1)
exit(-1);
if(sscanf(s,"%[0123456789]s",a)<1)
exit(-1);
alen=strlen(a);
if(alen==0)
exit(-1);
if(alen==1&&a[0]=='0'){
printf("0\n");
return 0;
}
for(i=0;i<=((alen-1)>>1);i++){
tmp=a[i];
a[i]=a[alen-1-i]-48;
a[alen-1-i]=tmp-48;
}
while(alen>0){
if(a[alen-1]==1){
c=1;
alen--;
} else {
c=0;
}
for(i=alen-1;i>=0;i--){
a[i]=10*c+a[i];
c=a[i]&1;
a[i]>>=1;
}
ans+=c;
}
printf("%d\n",ans);
return 0;
}