
usaco
泽7
这个作者很懒,什么都没留下…
展开
-
(usaco)双重回文数Dual Palindromes
题目传送门sxazr 从题中s+1开始枚举,判断每个数 #include <iostream> #include <cstdio> using namespace std; int n,s,k,q; void zr(int x,int y) { int a[100001],s=0; while(x){ a[++s]=x%y; x/=y; } if(a[1]=...原创 2019-03-21 21:35:17 · 253 阅读 · 0 评论 -
(usaco)修理牛棚 Barn Repair
题目传送门sxazr 本题可以这样想我这蒟蒻没想出 一条超长木板把所有牛棚覆盖,然后从中截去m-1段,就剩下m段了; 这样就可以简单的贪心了; 把每个有牛的牛棚之间的距离从大到小排序; 截去最大的m-1个就好了。 代码 #include <iostream> #include <cstdio> #include <algorithm> using namespa...原创 2019-03-24 11:33:21 · 351 阅读 · 0 评论 -
城堡 The Castle(uscao)
题目传送门sxazr 本体真的是因为细节问题花费了我将近两个小时的光阴啊 认真,仔细! 找连通块,每找完一个连通块把连通块内的每个方格标记上该连通块的序号, ( 在后面拆墙时判断是否在一个连通块里)记录最大的连通块; 枚举每个方格,拆墙(这里只枚举上面的墙和左面的墙就可以),记录最好的拆墙位置; 注意多解时选择输出那个; 输出有多少个连通块; 代码 #include <iostream>...原创 2019-03-31 09:10:29 · 253 阅读 · 0 评论 -
(usaco)牛式 Prime Cryptarithm
题目传送门sxazr 本题读懂题意就好了; 判断一下乘出来的数位数是否符合; 判断一下数中是否由输入中给出的数组成; 暴力枚举啦 代码 #include <iostream> #include <cstdio> using namespace std; int ans,n,a[10]; bool q(int x) { while(x) { if(!a[x%10]) ...原创 2019-03-24 16:16:37 · 243 阅读 · 0 评论 -
母亲的牛奶 Mother's Milk(usaco)
题目传送门sxazr 本题暴力搜索就可以 如果当前a,b,c组合出现过,就返回; 排序输出答案; 搜啊搜 代码 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; int A,B,C,s,ans[1000001]; bool fa[21],fb[21],f...原创 2019-03-24 17:19:34 · 816 阅读 · 0 评论