結果
問題 |
No.1335 1337
|
ユーザー |
![]() |
提出日時 | 2025-03-18 11:04:18 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 358 bytes |
コンパイル時間 | 425 ms |
コンパイル使用メモリ | 25,856 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-18 11:04:20 |
合計ジャッジ時間 | 1,568 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100]’ [-Wformat=] 6 | scanf("%s",&sample); | ~^ ~~~~~~~ | | | | | char (*)[100] | char * main.c:8:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100000]’ [-Wformat=] 8 | scanf("%s",&changeStr); | ~^ ~~~~~~~~~~ | | | | | char (*)[100000] | char * main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%s",&sample); | ^~~~~~~~~~~~~~~~~~~ main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%s",&changeStr); | ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> void main(void) { char sample[100] = "a"; scanf("%s",&sample); char changeStr[100000] = "b"; scanf("%s",&changeStr); for(int i = 0 ; i < (int)strlen(changeStr) ; i++){ if(changeStr[i]-'0' >= 0 && changeStr[i]-'0' <= 9){ printf("%c",sample[changeStr[i]-'0']); }else{ printf("%c",changeStr[i]); } } }