結果

問題 No.1942 Leading zero
ユーザー ruase_
提出日時 2025-08-15 01:28:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 673 bytes
コンパイル時間 1,111 ms
コンパイル使用メモリ 100,196 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-08-15 01:28:03
合計ジャッジ時間 1,799 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
# include <iostream>
# include <iomanip>

using namespace std;


int main()
{
    int n;
    cin >> n;
    string a[n];
    for (int i = 0; i < n; i++) cin >> a[i];

    for (int i = 0; i < n; i++) {
        string tmp = a[i];
        int str_idx = 0;
        while (true){
            if (tmp[str_idx] == '0') {
                tmp.replace(str_idx,1,"");
                str_idx = 0;
                if (tmp.length() == 1) {
                    a[i] = tmp;
                    break;
                }
            }else{

                break;
            }
        }
    }

    for (int i = 0 ; i < n ; i++) {
        cout << a[i] << endl;
    }


}
0