#include <stdio.h> #include <math.h> int main () { int n=0,w=0; scanf("%d",&n); for(int i=0;n==0;i) { if(n%10==1) w++; n=n/10; } printf("%d",w); return 0; }
Dev-c++没过,所以还没有提交到洛谷上。