[POJ 2356] Find a multiple】的更多相关文章

Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
从POJ 2356来体会抽屉原理的妙用= =! 题意: 给你一个n,然后给你n个数,让你输出一个数或者多个数,让这些数的和能够组成n: 先输出一个数,代表有多少个数的和,然后再输出这些数: 题解: 首先利用前缀和先预处理一下,然后如果sum[i]==0的话,很显然就直接输出i,然后接下来从第一位一直输出到第i位就行了 然后接下来直接用一个mod数组表示上一个答案为这个mod的时候的编号是多少 就是mod[sum[i]%n]=i; 然后判断一下if(mod[sum[i]%n]!=0)然后就直接从m…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6535   Accepted: 2849   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
Description The input contains N natural (i.e. positive integer) numbers ( N <= ). Each of that numbers . This numbers are not necessarily different (so it may happen that two or more of them will be equal). Your task <= few <= N ) so that the su…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6651   Accepted: 2910   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
链接:传送门 题意:题意与3370类似 注意:注意输出就ok,输出的是集合的值不是集合下标 /************************************************************************* > File Name: poj2356.cpp > Author: WArobot > Blog: http://www.cnblogs.com/WArobot/ > Created Time: 2017年04月30日 星期日 12时24分2…
POJ 1426   Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25734   Accepted: 10613   Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representati…
POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至找到满足条件的数,注意最高位一定为1 假设 n=6  k即为当前所求的目标数,不满足条件则进一步递推 (i 为层数(深度),在解法二的优化中体现,此时可以不管) 1%6=1 (k=1) i=1 { (1*10+0)%6=4 (k=10) i=2 { (10*10+0)%6=4 (k=100) i=4…
POJ 1426 Find The Multiple(寻找倍数) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may as…
POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个数字只能是1 * 10或者1 * 10 + 1.就按照这种方式枚举,依次放入队列,如果是其的倍数,就输出. 一开始没理解题意,以为是找一个能整除的二进制数,错了半天. 代码总览 #include <cstdio> #include <cstring> #include <algo…