zoukankan      html  css  js  c++  java
  • HDU--4722

    题目:

    Good Numbers

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722

    分析:找规律,每十个数中有一个。

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<cstring>
     4 #include<cmath>
     5 #include<algorithm>
     6 using namespace std;
     7 #define maxn 100005
     8 #define LL __int64
     9 int main()
    10 {
    11     int T,cas=1;
    12     cin>>T;
    13     LL l,r;
    14     while(T--)
    15     {
    16         scanf("%I64d%I64d",&l,&r);
    17         LL ll=l,rr=r;
    18         LL cnt1=0,cnt2=0;
    19                                 LL m1=l%10,m2=r%10;
    20                                 LL tmp1=l/10,tmp2=r/10;
    21         LL t1=(l-m1-1)/10,t2=(r-m2-1)/10;
    22         if(l==m1)t1=-1;
    23         if(r==m2)t2=-1;
    24         t1++,t2++;
    25         while(tmp1)
    26         {
    27             cnt1+=tmp1%10;
    28             tmp1/=10;
    29         }
    30         while(tmp2)
    31         {
    32             cnt2+=tmp2%10;
    33             tmp2/=10;
    34         }
    35         for(LL i=0;i<=m1;i++)
    36         {
    37             if((cnt1+i)%10==0)t1++;
    38         }
    39         for(LL i=0;i<=m2;i++)
    40         {
    41             if((cnt2+i)%10==0)t2++;
    42         }
    43         LL cnt=0;
    44         while(l)
    45         {
    46             cnt+=l%10;
    47             l/=10;
    48         }
    49         if(cnt%10==0)t2++;a
    50         printf("Case #%d: %I64d
    ",cas++,t2-t1);
    51     }
    52     return 0;
    53 }
    View Code
  • 相关阅读:
    数据库 mysql 语句
    document对象
    javascript
    css样式表及属性
    css格式布局
    html 标签
    html 标签
    第四章
    第三章
    第二章
  • 原文地址:https://www.cnblogs.com/i-love-acm/p/3323234.html
Copyright © 2011-2022 走看看