摘要: 思路: 变量pre记录前一个数, cnt记录段数. 如果发现当前数与当前pre的值不同,段数+1. #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n 阅读全文
posted @ 2019-07-10 17:51 域Anton 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 思路: 先判断是不是闰年, 如果是, 使存月份天数的数组month二月的位置+1(即从28天变29天). 1 #include <iostream> 2 using namespace std; 3 int month[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30 阅读全文
posted @ 2019-07-10 17:45 域Anton 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 思路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 阅读(195) 评论(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 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 int arr[1005]; // 编号 4 int ocr[1005]{0}; // 第几次出现 5 int main() 6 { 7 ios::sync_with_stdio(false); 8 cin.tie(0); 9 10 int n; 11 ci... 阅读全文
posted @ 2019-07-10 16:32 域Anton 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 思路1: 将每一条斜线作为一层, 可以证明一共有 n+n-1 层, 即 2*n-1 层. 再对每一层分别进行扫描. 扫描一层需要知道起点(终点通过起点、变换方式和矩形范围可以唯一确定)和扫描的方向(偶数层一个方向, 奇数层一个方向) 1 #include <iostream> 2 using nam 阅读全文
posted @ 2019-07-10 16:16 域Anton 阅读(166) 评论(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 阅读(164) 评论(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 阅读(202) 评论(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 阅读(153) 评论(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 阅读(225) 评论(0) 推荐(0) 编辑