結果
| 問題 | No.1594 Three Classes |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2021-07-10 23:39:24 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 299 bytes |
| 記録 | |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 25,176 KB |
| 最終ジャッジ日時 | 2026-02-22 07:29:42 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f':
main.c:7:25: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
7 | puts("Yes");
| ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
+++ |+#include <stdio.h>
1 | long e[12];
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 provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | long e[12];
main.c:8:25: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
8 | exit(0);
| ^~~~
main.c:8:25: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c: At top level:
main.c:17:1: error: return type defaults to 'int' [-Wimplicit-int]
17 | main(){
| ^~~~
main.c: In function 'main':
main.c:18:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
18 | scanf("%ld",&n);
| ^~~~~
main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
ソースコード
long e[12];
long n;
void f(long a,long b,long c,long i){
if(i==n){
if(a==b&&a==c){
puts("Yes");
exit(0);
}
}else{
f(a+e[i],b,c,i+1);
f(a,b+e[i],c,i+1);
f(a,b,c+e[i],i+1);
}
}
main(){
scanf("%ld",&n);
for(long i=0;i<n;++i){
scanf("%ld",&e[i]);
}
f(0,0,0,0);
puts("No");
}
tails