結果

問題 No.290 1010
ユーザー suppy193
提出日時 2017-02-02 16:28:17
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-24 03:53:03
合計ジャッジ時間 1,335 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[1000001]’ [-Wformat=]
    7 |         scanf("%s", &s);
      |                ~^   ~~
      |                 |   |
      |                 |   char (*)[1000001]
      |                 char *
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s", &s);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	int n;
	char s[1000001];
	scanf("%d", &n);
	scanf("%s", &s);
	
	if(n == 1){
		printf("NO\n");
	}
	else if(n == 2){
		if(s[0] == s[1]){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	else if(n == 3){
		if(s[0] == s[2] && s[0] != s[1]){
			printf("NO\n");
		}
		else{
			printf("YES\n");
		}
	}
	else{
		printf("YES\n");
	}

	return 0;
}
0