做题记录 Atcoder-Beginner-Contest-143
A - Curtain翻译练习高桥的房间的窗户宽A,有两个窗帘悬挂在窗户上,每一个窗帘水平长度为B(竖直方向足够长可以覆盖整个窗户),我们将关闭窗户,以尽量减少窗帘未遮挡部分的总水平长度。求窗户无遮挡部分的水平总长度。
12345678910111213141516171819202122232425#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x= x * 10 + ch - '0'; ...
ABC142
你是抱着多大的觉悟说出这种话的🙄️你只不过是一个学生,有办法背负其他人的人生吗😡“什么都愿意做”就是这么沉重的话😡做不来的事就别轻易说出口😡你这个人,满脑子都只想到自己呢😒
Aeasy
12345678910111213141516171819202122232425262728293031#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x= x * 10 + ch - '0'; ...
ABC139
A - Tenki模拟
123456789101112131415#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); string s, t; cin >> s >> t; int res = 0; for(int i = 0; i < 3; i++) if(s[i] == t[i]) res++; cout << res << endl; return 0;}
B - Power Socket模拟
12345678910111213141516171819#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){ ...
ABC138
A. Red or Not模拟
123456789101112131415#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[]){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int a; string s; cin >> a >> s; if(a >= 3200) cout << s << endl; else cout << "red" << endl; return 0;}
B. Resistors in Parallel模拟
123456789101112131415161718#include <bits/stdc++.h>using namespace std;int main(int argc, char const *argv[] ...
ABC134
今天六点起的,好困,F没写,想睡觉,醒了一定补
A123456789101112131415161718192021222324252627#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } retur ...
数论基础
整除/gcd设a,b两个整数,如果存在整数$c$使得$a=bc$,则称$b$整除$a$,又称$a$是$b$的倍数,$b$是$a$的因子,记作$a|b$.设两个整数a,b,且$b\ne 0$,则存在唯一的整数$q$和$r$使得$$ a = qb + r, 0 \le r < |b|$$
整数相关性质性质1:$$ a | c, b | c \Rightarrow ab | c$$性质2:$$ a | b, b | c \Rightarrow a | c$$性质3:设$m \ne 0$,则$$ a | b \Rightarrow ma | mb$$性质4:$$ 若a | b, b | a \Rightarrow a = \pm b$$
素数/合数应该没人不知道什么是素数pass
不知道该叫什么定理合数$m$的最小的不等于 1 的正因子$p$一定是素数,且$p \le \sqrt{m}$.
伯特兰-切比雪夫定理设整数$n > 3$,至少存在一个素数$p$满足$n < p < 2 * n - ...
Atcoder Beginner Contest 133
自己把题目翻译一遍就当,考研翻译训练了()
A T or T题意我们有$N$个人要去旅行,通过乘坐火车或者出租车进行出游,坐火车我们每个人要出$A$元(日元),做出租车我们总共会花费$B$元。请问,我们的旅费最少是多少?
思路直接计算两种出行方式的总花费,输出最小值
code123456789101112131415161718192021222324252627#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch ...
Atcoder Beginner Contest 132
A Fifty-Fifty12345678910111213141516171819202122232425262728293031323334353637#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } ...
Atcoder Beginner Contest 131
A Securit12345678910111213141516171819202122232425262728293031#include<bits/stdc++.h>#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f;}signed main() ...
Atcoder Beginner Contest 130(A-F)
A Rounding1234567891011121314151617181920212223242526#include<bits/stdc++.h>using namespace std;#define int long longint read(){ int x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f;}sig ...