zoukankan      html  css  js  c++  java
  • HDU 1017 A Mathematical Curiosity 数学题

    解题报告:输入两个数,n和m,求两个数a和b满足0<a<b<n,并且(a^2+b^2+m) % (a*b) =0,这样的a和b一共有多少对。注意这里的b<n,并不可以等于n。

    简单的数学题,要注意的就是格式,这题TM描述的真烂,注意每组测试数据之后有一个空行,但最后一组测试数据之后没有空行。

     1 #include<cstdio>
     2 int main()
     3 {
     4     int T,n,m;
     5     scanf("%d",&T);
     6     while(T--)
     7     {
     8         int f = 1;
     9         while(scanf("%d%d",&n,&m),n+m)
    10         {
    11             int tot = 0;
    12             for(int i = 1;i<n;++i)
    13             for(int j = i+1;j<n;++j)
    14             if((i*i + j*j + m) % (i*j) == 0)
    15             tot++;
    16             printf("Case %d: %d
    ",f++,tot);
    17         }
    18         if(T)
    19         puts("");
    20     }
    21     return 0;
    22 }
    View Code
  • 相关阅读:
    eclipse技巧总结
    java中的全等和相似
    curl命令
    tr命令
    Ubuntu下安装支付宝安全控件
    Firefox about
    Ubuntu Terminal Shortcut
    ulimit
    ajax post(copy part)
    getopt
  • 原文地址:https://www.cnblogs.com/xiaxiaosheng/p/3277397.html
Copyright © 2011-2022 走看看