結果

問題 No.564 背の順
ユーザー ひゅーらひゅーら
提出日時 2017-09-08 22:24:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 61,256 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:28:05
合計ジャッジ時間 990 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d%d", &h, &n);
      |         ~~~~~^~~~~~~~~~~~~~~~
main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |                 scanf("%d", &t);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
using namespace std;

int main(){
	int h, n;
	int ans = 0;
	scanf("%d%d", &h, &n);
	for(int i = 0; i < n-1; i++){
		int t;
		scanf("%d", &t);
		if(t >= h){
			ans++;
		}
	}
	printf("%d", ans+1);
	int a = ans+1 % 10;
	if(a == 1){
		printf("st\n");
	}else if(a == 2){
		printf("nd\n");
	}else if(a == 3){
		printf("rd\n");
	}else{
		printf("th\n");
	}
	return 0;
}
0