結果

問題 No.700 LOVE
ユーザー Maeda
提出日時 2025-03-11 09:32:38
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 25,728 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-11 09:32:40
合計ジャッジ時間 1,654 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d %d",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~
main.c:9:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |             scanf("%s",str[i]);
      |             ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(void){
	int n,m;
	scanf("%d %d",&n,&m);
    char str[n][100];
	for(int i = 0 ; i < n ; i ++){
	    scanf("%s",str[i]);
	}
    char decision[10];
    bool loveFlg = false;
	for(int i = 0 ; i < n; i++){
		for(int j = 0 ; j < 100;j++){
			if(str[i][j+4] == '\0'){
				break;
			}
			strncpy(decision, str[i]+j, 4);
			decision[4] = '\0';
			if(strcmp(decision,"LOVE") == 0){
				loveFlg = true;
				break;
			}
		}
		if(loveFlg){
			break;
		}
	}
	if(loveFlg){
		printf("YES");
	}else{
		printf("NO");
	}
}
0