結果
| 問題 | No.381 名声値を稼ごう Extra |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2016-06-18 08:30:07 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 346 bytes |
| 記録 | |
| コンパイル時間 | 164 ms |
| コンパイル使用メモリ | 30,020 KB |
| 最終ジャッジ日時 | 2026-02-23 21:37:19 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 2 |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
2 | a[140000];
| ^
main.c:3:1: warning: data definition has no type or storage class
3 | p[140000];
| ^
main.c:4:1: warning: data definition has no type or storage class
4 | n,m;
| ^
main.c: In function ‘main’:
main.c:20:11: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
20 | n=strlen(gets(s));
| ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
+++ |+#include <string.h>
1 | char s[1000010];
main.c:20:18: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [-Wint-conversion]
20 | n=strlen(gets(s));
| ^~~~~~~
| |
| int
main.c:20:18: note: expected ‘const char *’ but argument is of type ‘int’
main.c:24:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
24 | printf("%d",m);
| ^~~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
+++ |+#include <stdio.h>
1 | char s[1000010];
main.c: In function ‘ad’:
main.c:11:18: warning: iteration 139998 invokes undefined behavior [-Waggressive-loop-optimizations]
11 | a[x+1]+=a[x]>>25;
| ~^~~~~
main.c:9:18: note: within this loop
9 | for(x=1;x<140000;x++){
| ~^~~~~~~
/usr/bin/ld: /tmp/ccVjWLXs.o: in function `main':
main.c:(.text.startup+0x15): 警告: the `gets' function is dangerous and should not be used.
ソースコード
char s[1000010];
a[140000];
p[140000];
n,m;
ad(char i){
int x;
i-=48;
for(x=1;x<140000;x++){
a[x]+=p[x]*i;
a[x+1]+=a[x]>>25;
a[x]&=0x1FFFFFF;
p[x]*=10;
p[x]+=p[x-1]>>25;
p[x-1]&=0x1FFFFFF;
}
}
main(){
n=strlen(gets(s));
p[1]=1;
for(;n--;)ad(s[n]);
for(n=140000;n--;)m+=__builtin_popcount(a[n]);
printf("%d",m);
return 0;
}
testestest