結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2018-03-29 11:44:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 22,784 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 22:07:58 |
合計ジャッジ時間 | 1,895 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 5 | scanf("%d",&N); | ~^ ~~ | | | | | long long int* | int* | %lld main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld",&n_p); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ long long N; scanf("%d",&N); long long count = 0; long long n_p; long long maxmove = 0; for(long long p = 1; p <= N; p++){ scanf("%lld",&n_p); long long move; if(n_p < p) move = 1+(n_p-1); else/*n_p >= p*/ move = n_p - p; if(maxmove < move) maxmove=move; } printf("%lld\n",maxmove); }