随笔分类 -  训练题目

摘要:思路1: 在输入时按照旋转后的矩阵将数字存入数组. 1 #include <iostream> 2 using namespace std; 3 4 int arr[1005][1005]; 5 6 int main() 7 { 8 ios::sync_with_stdio(false); 9 ci 阅读全文
posted @ 2019-07-10 17:14 域Anton 阅读(205) 评论(0) 推荐(0)
摘要:1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 struct pairs{ 6 int index; 7 int times; 8 }; 9 pairs arr[1005]; 10 11 bool cmp 阅读全文
posted @ 2019-07-10 17:06 域Anton 阅读(146) 评论(0) 推荐(0)
摘要:思路1: 将每一条斜线作为一层, 可以证明一共有 n+n-1 层, 即 2*n-1 层. 再对每一层分别进行扫描. 扫描一层需要知道起点(终点通过起点、变换方式和矩形范围可以唯一确定)和扫描的方向(偶数层一个方向, 奇数层一个方向) 1 #include <iostream> 2 using nam 阅读全文
posted @ 2019-07-10 16:16 域Anton 阅读(186) 评论(0) 推荐(0)
摘要:1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 int arr[1005]; 6 7 int main() 8 { 9 ios::sync_with_stdio(false); 10 cin.tie(nu 阅读全文
posted @ 2019-07-10 14:32 域Anton 阅读(168) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 bool vis[105][105]{false}; 7 int main() 8 { 9 ios::sync_with_stdio(false); 10 cin.tie(0); 11 int n; 12 cin >> ... 阅读全文
posted @ 2019-07-10 14:28 域Anton 阅读(208) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 ios::sync_with_stdio(false); 9 cin.tie(0); 10 int n; 11 cin >> n; 12 set s; 13 for (i... 阅读全文
posted @ 2019-07-10 00:51 域Anton 阅读(160) 评论(0) 推荐(0)
摘要:#include #include using namespace std; struct form { int x1, y1, x2, y2; int id; int pri; }; form arr[15]; bool cmp (form a, form b) { return a.pri > b.pri; } int main() { ios... 阅读全文
posted @ 2019-07-10 00:46 域Anton 阅读(234) 评论(0) 推荐(0)
摘要:思路: 可以用string类型变量直接存字符串,根据题目要求确定参与计算的九个数字对应下标,用一个check变量存给定字符串的最后一位转换的数字(注意check可能是X),用sum变量存计算好的结果. 将sum % 11和check比较,如果一致输出Right,不一致将字符串最后一位改为sum%11 阅读全文
posted @ 2019-07-10 00:22 域Anton 阅读(238) 评论(0) 推荐(0)
摘要:题目: 思路: 利用一个数组记录每个数出现的次数(数组下标是出现的数,数组的值是出现数的次数). 边输入边统计,在统计的同时,用一个变量记录出现次数的最大值. 最后通过一次遍历(从最小的数开始),一旦发现出现次数与出现次数最大值相同的值,就输出数组下标. 需要分清楚数字的个数和数字的大小范围(数组大 阅读全文
posted @ 2019-07-10 00:04 域Anton 阅读(237) 评论(0) 推荐(0)
摘要:(ans & arr[j]) == ans 保证高位已有值不失效. ((ans[j] >> (i - 1)) & 1) == 1 当前位为1,cnt++, cnt >= 2 两把剑在这一位上相与为1 阅读全文
posted @ 2019-04-19 20:37 域Anton 阅读(235) 评论(0) 推荐(0)
摘要:数据范围是18位,把每一位加起来的和最多9*18 = 162 所以只需考虑n-162 ~ n的数即可,暴力解决 阅读全文
posted @ 2019-04-19 19:34 域Anton 阅读(173) 评论(0) 推荐(0)
摘要:任意一堆移动过后的石子都是整数x的倍数, 那么石子总数显然也应该是x的倍数, 换句话说,x必为石子数总和的一个质因子. 题目要求移动次数尽量小,那么x也应该尽量小. 所以选择石子数总和的最小质因子. 对每堆石子数进行取模运算即可知道每堆石子需要移走或增加多少石子. 然后就可以开始模拟了. 把取模后的 阅读全文
posted @ 2019-04-19 18:12 域Anton 阅读(199) 评论(0) 推荐(0)
摘要:打表找规律 打表发现第五项205开始,后一项减前一项的差值(第二排),再与之后的差值做差值,值都是28. 最终结果: 阅读全文
posted @ 2019-04-19 15:25 域Anton 阅读(143) 评论(0) 推荐(0)
摘要:1 #include <iostream> 2 using namespace std; 3 4 int n, m, q; 5 struct node { 6 int v; // 节点权值 7 int r; // 右侧节点在arr[]中的位置 8 int d; // 下侧节点在arr[]中的位置 9 阅读全文
posted @ 2019-04-19 11:46 域Anton 阅读(187) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstdio> using namespace std; typedef long long ll; ll dp[1000005]; // 第i天为晴天的概率 ll mod = 998244353; ll mulMod(ll a, ll b 阅读全文
posted @ 2019-04-18 16:43 域Anton 阅读(197) 评论(0) 推荐(0)