08 2013 档案
摘要:lightoj 1010 Knights in Chessboard链接:http://lightoj.com/volume_showproblem.php?problem=1010题意:国际象棋规则,在 m*n 的格子放某一棋子,棋子可以沿着它的8个方位直走,问盘子可以放多少个这样的棋子而使任意两个不发生冲突。思路:数学水题,找下算出几组,找下规律就出来了。值得注意的是有特判。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 #defi...
阅读全文
摘要:lightoj 1215 Finding LCM链接:http://www.lightoj.com/volume_showproblem.php?problem=1215题意:已知 a, b, l和 lcm(a, b, c) = l ,求最小的 c 的值。思路:先找 l 的素因子并判断此因子是否为 a, b 的素因子,如果是,则判断他们各自的欧拉值的大小。因为 c 最大可能等于 l 的值,所以刚开始先把l 的值赋给 c 。 当 l 中的某个素因子的欧拉值(lr1)大于 a,b 中相同的素因子的欧拉值(ar1, br1)时,c中肯定含有次素因子并且欧拉值(cr1 >= lr1),然而 c
阅读全文
摘要:uva 11424 GCD - Extreme (I)题意:思路:(见http://www.cnblogs.com/Duahanlang/p/3184994.html)差别在于数据规模和时间,其他一下,同样的思路,同样的做法代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 typedef long long LL;10 const int N = 200005;11 int e[N];12 LL tag[N];13 14 void eul...
阅读全文
摘要:lightoj 1214 Large Division (大数除法)链接:http://www.lightoj.com/volume_showproblem.php?problem=1214题意:给定 a, b 两个数,判断 a 是否整除 b 。(a 为 大数)思路: 用字符串存 a ,转化为 整型数组,用除法原理进行处理,没什么难度。其中关键是负号的处理。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 typedef long lon...
阅读全文

浙公网安备 33010602011771号