zoukankan      html  css  js  c++  java
  • 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;
    }
    
  • 相关阅读:
    Git/GitHub使用技巧
    《暗时间》第一遍读书心得整理
    学习方法摘要总结
    Py爬虫项目
    2018年6月12日
    狐狸坑蛋糕
    Codeforces 371C Hanburgers
    【别忘咯】 关于运算优先级
    【noip 2009】 乌龟棋 记忆化搜索&动规
    【Openjudge】 算24
  • 原文地址:https://www.cnblogs.com/ramanujan/p/3413029.html
Copyright © 2011-2022 走看看