結果
| 問題 |
No.729 文字swap
|
| コンテスト | |
| ユーザー |
Piroty19
|
| 提出日時 | 2018-09-26 16:07:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 222 bytes |
| コンパイル時間 | 386 ms |
| コンパイル使用メモリ | 54,764 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-10-11 00:19:53 |
| 合計ジャッジ時間 | 10,308 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘std::string*’ {aka ‘std::__cxx11::basic_string<char>*’} [-Wformat=]
9 | scanf("%s", &i);
| ~^ ~~
| | |
| | std::string* {aka std::__cxx11::basic_string<char>*}
| char*
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s", &i);
| ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &a);
| ~~~~~^~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &b);
| ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string>
#include<iostream>
int main()
{
std::string i;
int a, b;
char c;
scanf("%s", &i);
scanf("%d", &a);
scanf("%d", &b);
c = i[a];
i[a] = i[b];
i[b] = c;
std::cout << i;
return 0;
}
Piroty19