結果

問題 No.729 文字swap
ユーザー Heropro7
提出日時 2018-09-19 00:00:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 297 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 62,976 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 08:10:05
合計ジャッジ時間 2,567 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;
      |                ^~~
main.cpp:7:15: note: 'str' was declared here
    7 |         char* 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