U E D R , A S I H C RSS

coci_coko/권영기 (rev. 1.1)

coci_coko/권영기

[[[
#include<iostream>
int cnt = 1;
int main(void)
{
int n;
int ans1 = 0, ans2 = 0, sum = 0;
scanf("%d", &n);
while(1){
if(n <= cnt)break;
cnt = cnt * 2;
}
ans1 = cnt;
ans2 = -1;
while(cnt > 0 && sum != n){
if(sum + cnt <= n)sum += cnt;
cnt = cnt /2;
ans2++;
}
printf("%d %d", ans1, ans2);

}

]]]
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:38
Processing time 0.0346 sec