#20662: C++ AC


slime.creeper3@gmail.com (Slimlix)

School : No School
ID : 108310
IP address : [114.27.68.205]
Last Login :
2021-09-07 22:44:18
b759. 我明明就有說過= = | From: [180.217.167.11] | Post Date : 2020-02-18 01:26

#include <iostream>
#include <string>
using namespace std;

 


int main ()
{
string a;
while (cin >> a)
{
int k;
k = a.size();
cout << a << endl;
for (int r = 0 ; r < k-1 ; r++)
{
for (int i = 0 ; i < k-1 ; i++)
swap(a[i], a[i+1]);
cout << a << endl;
}


}
return 0;
}

外圈迴圈是重複次數

內圈迴圈是把最前面的元素換到最後面

 
#23335: Re:C++ AC


0520ryanyu (余秉侖)

School : 國立科學工業園區實驗高級中學
ID : 122637
IP address : [59.120.188.205]
Last Login :
2021-09-15 14:14:50
b759. 我明明就有說過= = | From: [60.251.194.164] | Post Date : 2020-11-08 22:26

烏龜回答: 喔是喔

 
ZeroJudge Forum