• hust 1606,乱搞


    G - Naive
    Time Limit:3000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu

    Description

    Give you a positive integer x, determine whether it is the sum of three positive cubic numbers.

    Input

    There’re several test cases. For each case:
    Only one line containing an integer x (1≤x≤10^6)

    Output

    For each test case, print “Yes” if it is or “No” if it isn’t.
    (See sample for more details)

    Sample Input

    1
    3
    10
    

    Sample Output

    No
    Yes
    Yes
    
    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<cstdlib>
    #include<algorithm>
    
    using namespace std;
    
    #define LL long long
    #define ULL unsigned long long
    #define UINT unsigned int
    #define MAX_INT 0x7fffffff
    #define MAX_LL 0x7fffffffffffffff
    #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
    #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
    
    #define N 1111111
    #define M 1000000
    int a[N];
    int p[N];
    
    int main(){
    //  fstream fin("C:\Users\Administrator\Desktop\in.txt",ios::in);
    
    //    memset(a,0,sizeof(a));
        int i,j=0;
        int b;
        for(i=1; i<=100; i++){
            a[j++]=i*i*i;
        }
        memset(p,0,sizeof(p));
        for(i=0; i<j; i++)
            for(int k=0; k<j; k++)
                for(int q=0; q<j; q++){
                    int ss=a[i] + a[k] +a[q];
                    if(ss <= M) p[ss]=1;
                }
    
        int x;
        while(scanf(" %d",&x)==1){
            printf("%s
    ",(p[x] ? "Yes" : "No"));
        }
    //  fin.close();
        return 0;
    }
    
  • 相关阅读:
    64位机配置iis 运行asp.net 程序(转载)
    病狗问题
    如何配置sqlcachedependence
    操作应用程序池
    自定义事件
    以下事情没做好决不能给客户演示
    判断用户ip是否在指定的ip段内
    silverlight4学习中解决的问题
    日历JS代码
    自己写的代码生成器ltscode2.0
  • 原文地址:https://www.cnblogs.com/ramanujan/p/3413029.html
Copyright © 2020-2023  润新知