結果
問題 | No.729 文字swap |
ユーザー |
![]() |
提出日時 | 2018-09-16 17:58:09 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 196 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 07:26:05 |
合計ジャッジ時間 | 2,292 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:13: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=] 10 | scanf("%d %d", a, b); | ~^ ~ | | | | int* int main.cpp:10:16: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘int’ [-Wformat=] 10 | scanf("%d %d", a, b); | ~^ ~ | | | | int* int main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s", c); | ~~~~~^~~~~~~~~ main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d %d", a, b); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:10:10: warning: ‘a’ is used uninitialized [-Wuninitialized] 10 | scanf("%d %d", a, b); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:10:10: warning: ‘b’ is used uninitialized [-Wuninitialized]
ソースコード
#include <stdio.h> int main(void) { int a,b; char c[11]; char d; scanf("%s", c); scanf("%d %d", a, b); d = c[a]; c[a] = c[b]; c[b] = d; printf("%s", c); }