結果

問題 No.3155 Same Birthday
ユーザー パクチー
提出日時 2025-08-08 12:52:23
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 547 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 26,696 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-08 12:52:31
合計ジャッジ時間 7,380 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 14 RE * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:13:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d %d", &a[i], &b[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
 
void main() {
 
	int n; //人数
	int a[100];    //誕生月
	int b[100];    //誕生日
	int found = 0; //一致する組があるかどうか
 
	printf("整数を入力してください\n");
	scanf("%d", &n);
	for (int i = 0; i < n ; i++){
		scanf("%d %d", &a[i], &b[i]);
	}
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (a[i] == a[j] && b[i] == b[j]) {
				found = 1;
				break;
			}
		}
		if (found == 1) {
			break;
		}
	}
	if (found == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}
0