TURNING ON STREET LIGHTS
Submit solution
C
Points:
10
Time limit:
300.0s
Memory limit:
64K
Author:
Problem type
Allowed languages
Problem Statement
You are given an 8 bit binary string consisting of only 1s and 0s where 1 indicates ON and 0 indicates OFF. You need to compute the minimum number of switches that need to be toggled so as to achieve the state where every switch is active.If min_switches > 4 output should be "More than half"
Eg: 11111001 2 11000111 3 11111111 0 00001001 More than half
Comments
include<stdio.h>
int main() { int a,y,count=0; scanf("%d",&a); while(a!=0) { y=a%10; if(y==0) { count++; } a=a/10;
}