結果
| 問題 | 
                            No.256 桁の数字を入れ替え (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             alpha_virginis
                         | 
                    
| 提出日時 | 2015-08-08 12:01:01 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 9 ms / 2,000 ms | 
| コード長 | 383 bytes | 
| コンパイル時間 | 1,397 ms | 
| コンパイル使用メモリ | 159,116 KB | 
| 実行使用メモリ | 6,940 KB | 
| 最終ジャッジ日時 | 2024-07-18 05:52:16 | 
| 合計ジャッジ時間 | 1,884 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:16: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   20 |       printf("%c", '0' + i);
      |               ~^   ~~~~~~~
      |                |       |
      |                int     long int
      |               %ld
            
            ソースコード
#include <bits/stdc++.h>
#include <stdint.h>
#include <sys/time.h>
int main() {
  long num[10] = {};
  std::string str;
  long n;
  std::cin >> str;
  n = str.size();
  for(long i = 0; i < n; ++i) {
    num[ str[i] - '0' ] += 1;
  }
  for(long i = 9; i >= 0; --i) {
    for(long j = 0; j < num[i]; ++j) {
      printf("%c", '0' + i);
    }
  }
  printf("\n");
  
  return 0;
}
            
            
            
        
            
alpha_virginis