Submission #63003735
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = 1; i <= (n); i++) // 1スタート
#define drep(i, n) for (ll i = (n) - 1; i >= 0; i--) // n-1スタート,
#define nfor(i, s, n) for (ll i = s; i < n; i++) // 任意の文字sからスタート
#define dfor(i, s, n) for (ll i = (s) - 1; i >= 0; i--) // s-1スタート
#define nall(a) a.begin(), a.end() // 昇順
#define rall(a) a.rbegin(), a.rend() // 降順
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
const ll INF = 2e18;
//(di[0],dj[0])の時は、上に移動
// U,L,D,R
const int di[] = {-1, 0, 1, 0}; //{[0],[1],[2],[3]}
const int dj[] = {0, -1, 0, 1}; // ixとdjを縦に見る
// int型:2^(-31) <= int <= (2^31)-1 1<<31
// A~Z:65~90,a~z:97~122 英小文字は26文字ある
// 0 + 'a'とすることで、数値型から英小文字に変換
// 例:1や123、777 の数値を 0001, 0123,0777のように先頭に0をつけて4桁にする
// scanf("%d.%d", &x, &y); 1.324を整数型で受け取る
// printf("%04d\n", n);
// printf("%.10lf\n", ans); 四捨五入してくれる
// printf("%d %c %d\n", si, sj, ans);
// printf("%02X\n", ans); 16進数で出力する xは小文字,Xは大文字のアルファベット
// 文字列の時は、s.c_str()
// printf("%s %s\n", s.c_str(), "san");
// 小数第n桁まで出力できる 四捨五入してくれる
// cout << fixed << setprecision(n) << ans << '\n';
// vector<vector<ll>> a(n);
// auto f = [&](ll i, ll j) -> void {};
// 0文字目から3文字まで
// s.substr(0,3);
// 3文字以降(3文字目も含めて)の文字列を全部
// s.substr(3);
// 切り捨て:A/B,切り上げ:(A + B - 1) / B
// 文字列を数値型に:s = "100" ⇒ ll num = stoll(s);
// char型を数値に:char c = '7' ⇒ c = c - '0'; '0'は数値型で48,'7'は数値型で55
// if(c >= 5) のように、char型と数値を比較すると、数値として認識される
// 0から0,1,2,3,4,5...と配列のサイズまで代入 配列ansで添え字を管理
// iota(ans.begin(), ans.end(), 0);
// 0文字目から3文字まで
// s.substr(0,3);
// 3文字以降(3文字目も含めて)の文字列を全部
// s.substr(3);
// 切り捨て:A/B,切り上げ:(A + B - 1) / B
// 文字列を数値型に:s = "100" ⇒ ll num = stoll(s);
// char型を数値に:char c = '7' ⇒ c = c - '0'; '0'は数値型で48,'7'は数値型で55
// if(c >= 5) のように、char型と数値を比較すると、数値として認識される
// llは10^18もok 1ll<<18 オーバーフローするため、1にllをつける
int main() {
string n;
cin >> n;
ll ans = 0;
for (char c : n) {
if (c == '2')
ans++;
}
string s;
rep(i, ans) s += '2';
cout << s << endl;
}
Submission Info
Submission Time |
|
Task |
A - 22222 |
User |
espresso_ |
Language |
C++ 20 (gcc 12.2) |
Score |
100 |
Code Size |
3106 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
3676 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample00.txt, sample01.txt, sample02.txt |
All |
sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt |
Case Name |
Status |
Exec Time |
Memory |
sample00.txt |
AC |
1 ms |
3480 KB |
sample01.txt |
AC |
1 ms |
3488 KB |
sample02.txt |
AC |
1 ms |
3528 KB |
testcase00.txt |
AC |
1 ms |
3488 KB |
testcase01.txt |
AC |
1 ms |
3516 KB |
testcase02.txt |
AC |
1 ms |
3556 KB |
testcase03.txt |
AC |
1 ms |
3520 KB |
testcase04.txt |
AC |
1 ms |
3468 KB |
testcase05.txt |
AC |
1 ms |
3596 KB |
testcase06.txt |
AC |
1 ms |
3548 KB |
testcase07.txt |
AC |
1 ms |
3488 KB |
testcase08.txt |
AC |
1 ms |
3516 KB |
testcase09.txt |
AC |
1 ms |
3544 KB |
testcase10.txt |
AC |
1 ms |
3676 KB |
testcase11.txt |
AC |
1 ms |
3468 KB |
testcase12.txt |
AC |
1 ms |
3388 KB |
testcase13.txt |
AC |
1 ms |
3520 KB |
testcase14.txt |
AC |
1 ms |
3456 KB |