結果

問題 No.729 文字swap
ユーザー Heropro7
提出日時 2018-09-18 23:52:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 297 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 53,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 08:10:01
合計ジャッジ時間 2,582 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:16: warning: ‘str’ is used uninitialized [-Wuninitialized]
    9 |         cin >> str;
      |                ^~~

ソースコード

diff #

#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;
}
0