CF #356 div1 A. Bear and Prime 100】的更多相关文章

题目链接:http://codeforces.com/contest/679/problem/A CF有史以来第一次出现交互式的题目,大致意思为选择2到100中某一个数字作为隐藏数,你可以询问最多20次问题,每一次询问一个数字x,如果预先选定的隐藏数是x的倍数,则回复"yes",否则回复"no",你只需要判那个数字是否为质数(不一定需要知道具体是多少) 如果一个数字是两个质数积的倍数,则这个数字一定是合数,另外需要注意,两个质数是可以相同的.即如果隐藏数是a*b的倍…
C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. In the output section below you will see the information about flushing the output. Bea…
C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. In the output section below you will see the information about flushing the output. Bea…
C. Bear and Prime 100 题目连接: http://www.codeforces.com/contest/680/problem/C Description This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden number - an i…
题目链接: C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. In the output section below you will see the information about flushing the outpu…
A - Bear and Prime 100 思路:任何一个合数都可以写成2个以上质数的乘积.在2-100中,除了4,9,25,49外都可以写成两个以上不同质数的乘积. 所以打一个质数加这四个数的表:{2,3,4,5,7,9,11,13,17,19,23,25,29,31,37,41,43,47,49},询问19次,如果能被整出两次以上,说明是合数,否则是质数. #include<bits/stdc++.h> using namespace std; #define ll long long…
C. Bear and Prime 100 time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output This is an interactive problem. In the output section below you will see the information about flushing the output. Bea…
[题目]A. Bear and Prime 100 [题意]有一数字x,每次可询问一个数字y是否x的因子,最后输出数字x是否素数,要求询问次数<=20. [题解]容易发现[2,100]范围内的非素数一定能分解为[2,47]范围内的素数的乘积,所以只需要询问[2,47]范围内的15个素数. 平方数需要特殊判断,有4,9,16,25,49.(36可以分解为(2*3)^2,不需要特判),恰好20次询问. #include<cstdio> ]={,,,,,,,,,,,,,,,,,,,,}; ];…
Bear and Prime 100Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 680C uDebug Description   Input   Output   Sample Input   Sample Output   Hint  …
链接:传送门 题意:给你一个隐藏数,这个隐藏数在[2,100]之间,现在最多可以询问20次,每次询问的是这个数是不是隐藏数的底数,是为yes,不是为no,每次询问后都需要flush一下输出缓冲区,最后判断这个数是不是素数. 思路:直接打出50以内的素数表,挨个进行询问,用计数器记录出现的因子个数,如果>1则说明为合数,需要特殊处理4,9,16,25,36,49,例如 49 --> 1 7 49 计数器1,但此数仍为合数. /***********************************…