結果
| 問題 | No.634 硬貨の枚数1 |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2018-01-19 21:41:03 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 323 bytes |
| 記録 | |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 25,144 KB |
| 最終ジャッジ日時 | 2026-02-22 00:41:33 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
1 | n;i;j;s;t;
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: warning: data definition has no type or storage class
1 | n;i;j;s;t;
| ^
main.c:1:3: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:5: warning: data definition has no type or storage class
1 | n;i;j;s;t;
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:7: warning: data definition has no type or storage class
1 | n;i;j;s;t;
| ^
main.c:1:7: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:1:9: warning: data definition has no type or storage class
1 | n;i;j;s;t;
| ^
main.c:1:9: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:3:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | scanf("%d",&n);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | n;i;j;s;t;
main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | scanf("%d",&n);
| ^~~~~
main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:25: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
7 | puts("1");
| ^~~~
main.c:7:25: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:8:25: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
8 | exit(0);
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or pr
ソースコード
n;i;j;s;t;
main(){
scanf("%d",&n);
for(i=0;;++i){
s=i*(i+1)/2;
if(s==n){
puts("1");
exit(0);
}
if(s>n){
break;
}
}
for(i=0;;++i){
s=i*(i+1)/2;
for(j=i;;++j){
t=s+j*(j+1)/2;
if(t==n){
puts("2");
exit(0);
}
if(t>n){
break;
}
}
if(s>n){
break;
}
}
puts("3");
}
tails