結果
| 問題 |
No.729 文字swap
|
| コンテスト | |
| ユーザー |
Heropro7
|
| 提出日時 | 2018-09-19 00:01:39 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 297 bytes |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 118,468 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 12:41:16 |
| 合計ジャッジ時間 | 1,228 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 11 |
コンパイルメッセージ
main.cpp:9:9: warning: variable 'str' is uninitialized when used here [-Wuninitialized]
9 | cin >> str;
| ^~~
main.cpp:7:11: note: initialize the variable 'str' to silence this warning
7 | char* str;
| ^
| = nullptr
1 warning generated.
ソースコード
#include<iostream>
using namespace std;
void swap(char* str,int n,int m);
int main(void){
char* str;
int n,m;
cin >> str;
cin >> n >> m;
swap(str,n,m);
cout << str << '\n';
return 0;
}
void swap(char* str,int n,int m){
char tmp;
tmp=*(str+n);
*(str+n)=*(str+m);
*(str+m)=tmp;
}
Heropro7