BUPT OJ210 Rist-Number

来源:互联网 发布:淘宝卖家批量发货 编辑:程序博客网 时间:2024/05/18 02:05

题目描述

Rist-Number is a kind of integers that should satisfy some restrictions. Define S as the set of all Rist-Numbers, then we have

  1. 1S
  2. 3×SS
  3. 7×SS
  4. 15×SS
  5. 31×SS

Obviously, S is an infinite set. Given n, judge whether nS is true.

输入格式

The input contains multiple test cases.

The first line of input contains an integer T(T100), which denotes the number of test cases.

The following T lines describe all the queries, each with an integer n(1n10000).

输出格式

For each test case, output True if the statement is true, otherwise output False.

输入样例

212

输出样例

TrueFalse

不知为何用除法判断是否只含有3,7,15,31的素因数会WA, 可能是OJ数据有问题吧.



/*USER_ID: test#birdstormPROBLEM: 210SUBMISSION_TIME: 2014-04-01 12:35:16*/#include <stdio.h>#include <stdlib.h>#define For(i,m,n) for(i=(m);i<(n);i++)#define MAXN 100005  int a[MAXN];  main(){    int t, n;    scanf("%d",&t);    a[1]=1;    For(n,1,3000) if(a[n]) a[n*3]=a[n*7]=a[n*15]=a[n*31]=1;    while(t--){        scanf("%d",&n);        if(a[n]==1) puts("True");        else puts("False");    }    return 0;}


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 喝咖啡晚上睡不着怎么办 煮米饭水放少了怎么办 蜗牛睡眠两个人怎么办 军用水壶变形了怎么办 鱼缸过滤效果不好怎么办? 煮水壶有水垢怎么办 猫咪喝了咖啡怎么办 军用水壶凹了怎么办 新电水壶有味道怎么办 猫夏天不喝水怎么办 军用水壶瘪了怎么办 木头壶盖有异味怎么办 挎包拉链坏了怎么办 斜挎包没有拉链怎么办 树脂补牙没抛光怎么办 猪拉稀不吃食怎么办 亚麻衣服刺皮肤怎么办 自热米饭不熟怎么办 孕妇用了微波炉怎么办 蛋挞变软了怎么办 外卖炒面坨了怎么办 手机发热充电慢怎么办 饭盒盖子松了怎么办 饭盒盖子盖不住怎么办 饭盒盖子吸不住怎么办 饭盒盖子变形了怎么办 饭盒盖子凹进去怎么办 饭盒盖吸不住怎么办 饭盒微波炉加热后打不开怎么办 微波炉加热饭盒打不开怎么办 塑料饭盒加热后打不开怎么办 真空锅锅盖打不开怎么办 玻璃真空水壶打不开怎么办 保温饭盒盖子打不开怎么办 饭盒盖章松了怎么办 电压力锅卡住了怎么办 铁的饭盒打不开怎么办 微波炉饭盒盖子打不开怎么办 微波炉盖子吸住了怎么办 剩下的糯米饭怎么办 饭盒微波加热打不开怎么办