結果
| 問題 |
No.381 名声値を稼ごう Extra
|
| コンテスト | |
| ユーザー |
👑 testestest
|
| 提出日時 | 2019-10-31 19:38:06 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 498 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 30,336 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-09-14 22:09:26 |
| 合計ジャッジ時間 | 9,596 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 |
コンパイルメッセージ
main.c:5:1: warning: return type defaults to 'int' [-Wimplicit-int]
5 | main(){
| ^~~~
main.c: In function 'main':
main.c:7:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
7 | scanf("%s",s);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define keta 19
main.c:7:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
7 | scanf("%s",s);
| ^~~~~
main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:17: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
8 | int len=strlen(s);
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
+++ |+#include <string.h>
1 | #define keta 19
main.c:8:17: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
8 | int len=strlen(s);
| ^~~~~~
main.c:8:17: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:22:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
22 | printf("%d",ans);
| ^~~~~~
main.c:22:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:22:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:22:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#define keta 19
#define p5 19073486328125LL
#define p2 0x7FFFF
long long a[1123456];
main(){
char s[1123456];
scanf("%s",s);
int len=strlen(s);
int cnt=len/keta;
for(int i=0;i<cnt;i++)for(int k=keta;k>=1;k--)a[i]=a[i]*10+(s[len-keta*i-k]-48);
if(len%keta){
for(int k=0;k<len%keta;k++)a[cnt]=a[cnt]*10+(s[k]-48);
cnt++;
}
int ans=0;
while(cnt){
ans+=__builtin_popcount(a[0]&p2);
for(int i=0;i<cnt;i++)a[i]=(a[i]>>keta)+(a[i+1]&p2)*p5;
if(!a[cnt-1])cnt--;
}
printf("%d",ans);
}
testestest