結果
問題 |
No.2778 Is there Same letter?
|
ユーザー |
![]() |
提出日時 | 2025-03-17 16:04:36 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 455 ms |
コンパイル使用メモリ | 25,088 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-17 16:04:38 |
合計ジャッジ時間 | 1,273 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
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",&n); | ^~~~~~~~~~~~~~ main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%s",str); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdbool.h> void main(void) { int n = 0; scanf("%d",&n); char str[100] = "a"; scanf("%s",str); bool sameFlg = false; for(int i = 1 ; i < n ; i++ ){ for(int j = 0 ; j < i ;j++){ if(str[i] == str[j]){ sameFlg = true; break; } } if(sameFlg){ break; } } if(sameFlg){ printf("Yes"); }else{ printf("No"); } }