摘要: A 分糖果 做一个简单的取模,然后取min即可 #include <bits/stdc++.h> using namespace std; int n , l , r ; int main() { cin >> n >> l >> r; r -= l/n*n , l %= n; cout << mi 阅读全文
posted @ 2021-12-05 17:14 PHarr 阅读(28) 评论(0) 推荐(0) 编辑
摘要: A dreamstart的催促 快速幂模板题 #include<bits/stdc++.h> #define ll long long using namespace std; const int mod = 10000019; int n , ans = 0; int ksm( ll x , ll 阅读全文
posted @ 2021-12-04 13:50 PHarr 阅读(34) 评论(0) 推荐(0) 编辑
摘要: A - First Grid $2\times 2$矩阵只有两种情况不满足 .# #. #. .# 特判即可 如果一个#相邻的三个格子全是.则一定不可能联通 #include<bits/stdc++.h> using namespace std; int main(){ string s1,s2; 阅读全文
posted @ 2021-11-28 20:08 PHarr 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 比赛链接 A.星图 l[i],r[i],u[i],d[i]分别代表第$i$行或(列)从某个方向看过去的第一个黑洞所在位置 然后判断对应的黑洞是否在当前点的后面 #include <bits/stdc++.h> using namespace std; const int N = 1005; int 阅读全文
posted @ 2021-11-24 20:32 PHarr 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 1216 一道比较简单的递推题目 f[i][j] += max( f[i-1][j] , f[i-1][j-1]) #include<bits/stdc++.h> using namespace std; const int N = 1010; int r,a[N][N] = {},maxx = 0 阅读全文
posted @ 2021-11-21 21:12 PHarr 阅读(50) 评论(0) 推荐(0) 编辑
摘要: P2249 二分答案 直接套用lower_bound() #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int n , m , a[N]; inline int read() { register int x 阅读全文
posted @ 2021-11-19 14:11 PHarr 阅读(28) 评论(0) 推荐(0) 编辑
摘要: A 没有一百毫升有A卡路里,B毫升中有多少卡路里 #include <bits/stdc++.h> using namespace std; int main() { double a , b; cin >> a >> b; cout << a * b / 100 << endl; return 0 阅读全文
posted @ 2021-11-15 19:09 PHarr 阅读(91) 评论(0) 推荐(0) 编辑
摘要: A 正反各跑一遍匹配 正着满足,反着不满足,没有坐反 正着不满足,反着满足,坐反 都满足,不知道 #include <bits/stdc++.h> using namespace std; int n , m , x , y , a[20] , b[20] , c1[20] , c2[20] , o 阅读全文
posted @ 2021-11-10 22:22 PHarr 阅读(452) 评论(0) 推荐(0) 编辑
摘要: A 签到 #include <bits/stdc++.h> using namespace std; int main() { int a , b; cin >> a >> b; cout << a * b << endl; return 0; } B 签到,用long long #include 阅读全文
posted @ 2021-11-03 14:47 PHarr 阅读(68) 评论(0) 推荐(0) 编辑
摘要: A 给一个数列[1...5]其中有一位是错误的,错误位置是0,问哪一位错误 #include <bits/stdc++.h> using namespace std; int main() { for( int i = 1 , x ; i <= 5 ; i ++ ) { cin >> x; if( 阅读全文
posted @ 2021-10-24 21:59 PHarr 阅读(108) 评论(0) 推荐(0) 编辑