結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー hanorverhanorver
提出日時 2015-08-20 00:19:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 71,344 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 13:41:02
合計ジャッジ時間 1,368 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<functional>

int main() {
	std::string num;
	std::vector<int> v;

	std::cin >> num;

	//vectorにint型にした値を入れる
	std::for_each(num.begin(), num.end(), [&](char c) {v.push_back(c - '0'); });
	
	//降順にソート
	std::sort(v.begin(), v.end(), std::greater<int>());
	
	std::for_each(v.begin(), v.end(), [](int x) {std::cout << x; });
	std::cout << std::endl;

	return 0;
}
0