結果

問題 No.564 背の順
ユーザー ひゅーらひゅーら
提出日時 2017-09-08 22:24:14
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 61,132 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 05:22:17
合計ジャッジ時間 1,290 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
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