結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー nasadigitalnasadigital
提出日時 2015-07-31 22:59:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 52,296 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-24 22:59:00
合計ジャッジ時間 873 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 8 ms
4,380 KB
testcase_03 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    string n;
    cin>>n;
    int occ[10];
    memset(occ,0,sizeof(occ));
    for(int ctr1=0;ctr1<n.length();ctr1++){
        occ[n[ctr1]-'0']++;
    }
    for(int ctr1=9;ctr1>=0;ctr1--)
        for(int ctr2=0;ctr2<occ[ctr1];ctr2++)
            cout<<ctr1;

    cout<<endl;
    return 0;
}
0