結果

問題 No.1942 Leading zero
ユーザー 👑 CleyL
提出日時 2022-05-21 19:56:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 71,264 KB
最終ジャッジ日時 2025-01-29 13:10:31
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;cin>>n;
    for(int i = 0; n > i; i++){
        string s;cin>>s;
        reverse(s.begin(),s.end());
        while(s.size() && s[s.size()-1] == '0'){
            s.pop_back();
        }
        if(!s.size())s.push_back('0');
        reverse(s.begin(),s.end());
        cout << s << endl;
    }
}
0