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;
    }
    
  • 相关阅读:
    flutter资料
    flutter兼论
    Dart 学习
    flutter简易教程
    全球15个顶级技术类博客
    Grunt压缩HTML和CSS
    用grunt搭建自动化的web前端开发环境-完整教程
    正确代码之-grunt
    grunt写一个px和rem互转的工具
    unslider使用方法1
  • 原文地址:https://www.cnblogs.com/ramanujan/p/3413029.html
Copyright © 2011-2022 走看看