空间限制:C/C++ 32768K,其他语言65536K
64bit IO Format: %lld
题目描述
输入描述:
输出描述:
每行输出对应行的数的位数和。
输入
2 10 101
输出
1 2
输入
2 111111111111111111111111111111111111 222222222222222222222222222222222222
输出
36 72
【代码】:


#include<bits/stdc++.h> using namespace std;int main() {char s[250];int t,x;int ans;cin>>t;while(t--){ans=0;scanf("%s",s);//printf("length = %d\n",strlen(s));for(int i=0;i<strlen(s);i++){//if(s[i]==0) continue;ans+=(s[i]-'0')%10;x=s[i]-'0';x/=10;}printf("%d\n",ans);} }