結果
| 問題 |
No.504 ゲーム大会(ランキング)
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-07 14:15:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 378 bytes |
| コンパイル時間 | 403 ms |
| コンパイル使用メモリ | 27,392 KB |
| 実行使用メモリ | 8,608 KB |
| 最終ジャッジ日時 | 2025-03-07 14:15:17 |
| 合計ジャッジ時間 | 2,644 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:18: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘int*’ [-Wformat=]
6 | scanf("%ld",&num);
| ~~^ ~~~~
| | |
| | int*
| long int*
| %d
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%ld",&num);
| ~~~~~^~~~~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%ld",&score);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
// 参加人数
int num = 0;
scanf("%ld",&num);
// 暫定順位
int rank = 1;
// 自分のスコア
long myscore = 0;
// 参加人数分だけループ
for(int i = 1;i <= num;i++){
long score = 0;
scanf("%ld",&score);
if(i == 1){
myscore = score;
}else{
if(myscore < score){
rank++;
}
}
printf("%d\n",rank);
}
}
sasa