F数圈圈

Description

幼儿园的小朋友对数字其实不是很感兴趣,他们更感兴趣的是形状,现在给你一个数字,小朋友都会数出其中一共有多少圆圈圈

Input

一个数字n长度不超过19位

Output

输出其中的圈圈数总数

Sample Input

14589
20869
12357
**Sample Output** **Hint** 3 5 0
#include 
#include 
int sc(char m)
{
    int s = 0;
    if ( m == '6'||m == '9' || m == '0')
        s = 1;
    if ( m == '8')
        s = 2;
    return s;
}

int main()
{
    char a[20];
    int k, s,i;
    while ( 1 == scanf("%s",a))
    {
        s = 0;
        k = strlen(a);
        for (i=0; i

//标准代码
#include 
#include 
int q[] = {
  1, 0, 0, 0, 0, 0, 1, 0, 2, 1,
};
int main(){
  long long n;
  int s;
  freopen("A.in", "r", stdin);
  freopen("A.out", "w", stdout);
  while (~scanf("%I64d", &n)){
    s = 0;
    while (n)
      s += q[n % 10], n /= 10;
    printf("%d\n", s);
  }
  return 0;
}
坚持原创技术分享,您的支持将鼓励我继续创作!
  • 本文作者: Fayne
  • 本文链接: 400.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!