結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2025-03-17 14:08:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 453 ms |
コンパイル使用メモリ | 28,288 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-17 14:08:40 |
合計ジャッジ時間 | 1,956 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=] 14 | printf("%d %d %d",i,loc[i],loc[j]); | ~^ ~ | | | | int long int | %ld main.cpp:14:45: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=] 14 | printf("%d %d %d",i,loc[i],loc[j]); | ~^ ~~~~~~ | | | | int long int | %ld main.cpp:14:48: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=] 14 | printf("%d %d %d",i,loc[i],loc[j]); | ~^ ~~~~~~ | | | | int long int | %ld main.cpp:27:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long int’ [-Wformat=] 27 | scanf("%d ",loc[i]); | ~^ ~~~~~~ | | | | int* long int main.cpp:4:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | scanf("%ld",&val); | ~~~~~^~~~~~~~~~~~ main.cpp:8:22: warning: ignori
ソースコード
#include <stdio.h> int main(void){ long val = 0; scanf("%ld",&val); long loc[val]; for(long i = 0;i < val;i ++){ scanf("%ld",&loc[i]); } for(long i = 0;i < val;i ++){ for(long j = 0;j < val;j ++){ if(loc[i] == loc[j]){ printf("%d %d %d",i,loc[i],loc[j]); printf("NO"); return 0; } if(loc[i] < loc[j]){ int tmp = loc[i]; loc[i] = loc[j]; loc[j] = tmp; } } } for(int i = 0;i < val;i ++){ scanf("%d ",loc[i]); } printf("\n"); long interval = loc[1] - loc[0]; for(int i = 2;i < val;i ++){ if(interval != (loc[i] - loc[i - 1])){ printf("NO"); return 0; } } printf("YES"); }