結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-10 16:38:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 816 bytes |
| コンパイル時間 | 517 ms |
| コンパイル使用メモリ | 28,288 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-10 16:38:17 |
| 合計ジャッジ時間 | 4,546 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
12 | scanf("%d",A[i]);
| ~^ ~~~~
| | |
| int* int
main.cpp:27:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
27 | scanf("%d",B[i]);
| ~^ ~~~~
| | |
| int* int
main.cpp:4:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
4 | scanf("%d",&num);
| ~~~~~^~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d",A[i]);
| ~~~~~^~~~~~~~~~~
main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | scanf("%d",B[i]);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int num = 0;
scanf("%d",&num);
double ans = 0;
int A[num];
int B[num];
// 入力された値を配列に格納
for(int i = 0;i < num;i++){
scanf("%d",A[i]);
}
// ソート昇順
for(int i = 0;i < num;i++){
for(int j = 0;j < num;j++){
if(A[i] < A[j]){
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}
}
}
// 入力された値を配列に格納
for(int i = 0;i < num;i++){
scanf("%d",B[i]);
}
// ソート降順
for(int i = 0;i < num;i++){
for(int j = 0;j < num;j++){
if(B[i] > B[j]){
int tmp = B[i];
B[i] = B[j];
B[j] = tmp;
}
}
}
// どちらが何回勝利するかカウントする
int countA = 0;
for(int i = 0;i < num;i++){
if(A[i] > B[i]){
countA++;
}
}
// 勝率の計算
ans = countA / num;
}
sasa