#29611: C++解題


qwe941118@gmail.com (105-20蕭英志)

學校 : 不指定學校
編號 : 179819
來源 : [114.26.94.17]
最後登入時間 :
2023-06-16 10:53:39
a038. 數字翻轉 | From: [114.26.88.5] | 發表日期 : 2022-03-14 08:42

#include <iostream>

#include <string> 

#include <sstream>

using namespace std;

int main()

{

string x;

while (cin >> x)

{

string y;

for (int i = x.length()-1; i >= 0; i--)

{

y = y + x[i];

}

while (y[0] == '0' && y.length()>1)

{

y.erase(0, 1);

}

cout << y << endl;

}

}

 
ZeroJudge Forum