Submission #50899


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
signed main()
{
cin.tie(0); ios::sync_with_stdio(false);
int n; cin >> n;
int cnt = 0;
while (n > 0) {
cnt += (n & 1);
n /= 2;
}
cout << cnt << endl;
return 0;
}

ステータス

項目 データ
問題 1123 - こんなの一瞬だろ
ユーザー名 もけ
投稿日時 2019-06-24 20:14:29
言語 C++
状態 Accepted
得点 1
ソースコード長 626 Byte
最大実行時間 26 ms
最大メモリ使用量 680 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample1 AC 23 ms 604 KB
1
input-sample2 AC 20 ms 560 KB
1
input01 AC 14 ms 648 KB
1
input02 AC 26 ms 608 KB
1
input03 AC 23 ms 556 KB
1
input04 AC 18 ms 516 KB
1
input05 AC 18 ms 468 KB
1
input06 AC 21 ms 680 KB
1
input07 AC 23 ms 508 KB
1
input08 AC 19 ms 468 KB
1
input09 AC 17 ms 420 KB
1
input10 AC 23 ms 632 KB
1
input11 AC 17 ms 464 KB
1
input12 AC 19 ms 420 KB
1
input13 AC 23 ms 632 KB
1
input14 AC 24 ms 588 KB
1
input15 AC 18 ms 548 KB
1