結果
| 問題 |
No.494 yukicoder
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-13 17:10:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 206 bytes |
| コンパイル時間 | 411 ms |
| コンパイル使用メモリ | 28,160 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-13 17:10:28 |
| 合計ジャッジ時間 | 1,132 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:21: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
5 | char *ans = "yukicoder";
| ^~~~~~~~~~~
main.cpp:7:25: warning: ‘str’ is used uninitialized [-Wuninitialized]
7 | int len = strlen(str);
| ~~~~~~^~~~~
In file included from main.cpp:2:
/usr/include/string.h:407:15: note: by argument 1 of type ‘const char*’ to ‘size_t strlen(const char*)’ declared here
407 | extern size_t strlen (const char *__s)
| ^~~~~~
main.cpp:6:14: note: ‘str’ declared here
6 | char str[10];
| ^~~
main.cpp:11:37: warning: ‘str’ may be used uninitialized [-Wmaybe-uninitialized]
11 | printf("%c",*(str + 1));
| ^~~~~~~~~~
main.cpp:6:14: note: ‘str’ declared here
6 | char str[10];
| ^~~
ソースコード
#include <stdio.h>
#include <string.h>
int main(){
char *ans = "yukicoder";
char str[10];
int len = strlen(str);
for(int i = 0;i < len;i++){
if(str[i] == '?'){
printf("%c",*(str + 1));
}
}
}
sasa