結果

問題 No.729 文字swap
ユーザー vividrabbit
提出日時 2018-11-06 11:53:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 56,368 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-20 20:24:35
合計ジャッジ時間 958 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main(){
	string input;
	int pos_a,pos_b;
	cin >> input >> pos_a >> pos_b;
	for(int i=0;i<input.size();i++){
		if(i==pos_a) cout<<input[pos_b];
		else if(i==pos_b) cout<<input[pos_a];
		else cout<<input[i];
	}
	cout << "\n";
	return 0;
}
0