zoukankan      html  css  js  c++  java
  • HDU 1017: A Mathematical Curiosity

    1

    10 1
    20 3
    30 4
    0 0

    Case 1: 2
    Case 2: 4
    Case 3: 5

    分析:水题。。

    #include <iostream>
    #include <string>
    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <deque>
    #include <map>
    #define range(i,a,b) for(int i=a;i<=b;++i)
    #define LL long long
    #define rerange(i,a,b) for(int i=a;i>=b;--i)
    #define fill(arr,tmp) memset(arr,tmp,sizeof(arr))
    using namespace std;
    int T;
    void init() {
        cin>>T;
    }
    int cal(int n,int m){
        int res=0;
        range(i,1,n-1)
        range(j,1,i-1)res+=(((j-i)*(j-i)+m)%(i*j))?0:1;
        return res;
    }
    void solve(){
        while(T--){
            int cas=0,n,m;
            while(cin>>n>>m,n+m){
                cout<<"Case "<<++cas<<": "<<cal(n,m)<<endl;
            }
            if(T)cout<<endl;
        }
    }
    int main() {
        init();
        solve();
        return 0;
    }
    View Code
  • 相关阅读:
    图片上传-下载-删除等图片管理的若干经验总结3-单一业务场景的完整解决方案
    图片上传-下载-删除等图片管理的若干经验总结2
    HDU 1195 Open the Lock
    HDU 1690 Bus System
    HDU 2647 Reward
    HDU 2680 Choose the best route
    HDU 1596 find the safest road
    POJ 1904 King's Quest
    CDOJ 889 Battle for Silver
    CDOJ 888 Absurdistan Roads
  • 原文地址:https://www.cnblogs.com/Rhythm-/p/9333413.html
Copyright © 2011-2022 走看看