Submission #55111


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
int n,a,ans=0,b=1;
cin>>n;
a=n;
while(a!=0){
while((a-b)>=0){
b*=2;
}
if(a<b){
b/=2;
}
a-=b;
ans+=1;
b-=(b-1);
}
cout<<ans<<"\n";
return 0;
}

ステータス

項目 データ
問題 1123 - こんなの一瞬だろ
ユーザー名 p1918
投稿日時 2019-09-24 16:22:53
言語 C++
状態 Accepted
得点 1
ソースコード長 306 Byte
最大実行時間 30 ms
最大メモリ使用量 672 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample1 AC 30 ms 600 KB
1
input-sample2 AC 21 ms 556 KB
1
input01 AC 21 ms 388 KB
1
input02 AC 24 ms 472 KB
1
input03 AC 20 ms 560 KB
1
input04 AC 21 ms 508 KB
1
input05 AC 22 ms 468 KB
1
input06 AC 20 ms 548 KB
1
input07 AC 25 ms 504 KB
1
input08 AC 19 ms 592 KB
1
input09 AC 20 ms 544 KB
1
input10 AC 20 ms 376 KB
1
input11 AC 19 ms 460 KB
1
input12 AC 24 ms 416 KB
1
input13 AC 17 ms 628 KB
1
input14 AC 27 ms 588 KB
1
input15 AC 19 ms 672 KB
1