Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef long long LL;
- int main(){
- LL a[256] = { 0 };
- int n, i;
- scanf("%d", &n);
- for(i = 0; i < n; i++){
- scanf("%lld", a + i);
- }
- int flag1 = 1, flag2 = 1, times = 0, fin = 0;
- while(flag1 && flag2){
- flag1 = 0; flag2 = 0;
- for(i = 0; i < n; i++){
- if(a[i]){
- a[i] >>= 1;
- if(a[i]){
- flag1 = 1;//need to continue
- }
- else{
- flag2 = 1;//able to continue
- }
- }
- }
- times += 1;
- }
- printf("%d\n", times);
- for(i = 0; i < n; i++){
- if(a[i]){
- fin = 1;
- }
- }
- puts(fin ? "Some number left..." : "Clear!");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement