AtCoder Beginner Contest 118 解题报告】的更多相关文章

A - B +/- A #include <bits/stdc++.h> int main() { int a, b; std::cin >> a >> b; b % a ? std::cout << b - a : std::cout << a + b; } B - Foods Loved by Everyone #include <bits/stdc++.h> int cnt[31], ans; int main() { int…
手速选手成功混进rated only里面的前30名,但是总排名就到110+了... A - Double Helix #include <bits/stdc++.h> #define ll long long #define inf 0x3f3f3f3f #define il inline namespace io { #define in(a) a = read() #define out(a) write(a) #define outn(a) out(a), putchar('\n') #…
题目地址 https://atcoder.jp/contests/abc146/tasks 感觉没有什么有意思的题... 题解 A #include <bits/stdc++.h> using namespace std; string s; int main() { cin >> s; int now = 0; if(s[0] == 'S') { if(s[1] == 'U') now = 0; else now = 6; } if(s[0] == 'M') now = 1; i…
心态爆炸.本来能全做出来的.但是由于双开了Comet oj一个比赛,写了ABC就去搞那个的B题 还被搞死了. 回来写了一会D就过了.可惜比赛已经结束了.真的是作死. A - Buttons #include <cstdio> using namespace std; int main() { int x, y; scanf("%d%d", &x, &y); int ans = x > y ? x : y; if (x > y) x--; else…
为啥最近都没有arc啊... A - Favorite Sound #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector> #include <queue> #include <cmath> #include <stack> #…
果然abc都是手速场. 倒序开的qwq. D题因为忘记1e12二进制几位上界爆了一发. A - Entrance Examination 就是除一下就行了... 看样例猜题意系列. #include<cstdio> #include<algorithm> #include<cstring> int main(){ double t,x; scanf("%lf%lf",&t,&x); printf("%lf",t/x…
前四题都好水.后面两道题好难. C Divide the Problems #include <cstdio> #include <algorithm> using namespace std; inline int read() { , f = ; char ch = getchar(); ; ch = getchar(); } + ch - ; ch = getchar(); } return x * f; } ; int a[N]; int main() { int n =…
传送门 写了四个题就跑去打球了.第五题应该能肝出来的. A - Airplane #include <bits/stdc++.h> using namespace std; inline int read() { , f = ; char ch = getchar(); ; ch = getchar(); } + ch - ; ch = getchar(); } return x * f; } int main() { int a = read(), b = read(), c = read(…
传送门 非常遗憾.当天晚上错过这一场.不过感觉也会掉分的吧.后面两题偏结论题,打了的话应该想不出来. A - Ferris Wheel #include <bits/stdc++.h> using namespace std; inline int read() { , f = ; char ch = getchar(); ; ch = getchar(); } + ch - ; ch = getchar(); } return x * f; } int main() { int a = re…
突然6道题.有点慌.比赛写了五个.罚时爆炸.最后一个时间不太够+没敢写就放弃了. 两道题奇奇怪怪的WJ和20/20.今天的评测机是怎么了. A Changing a Character #include <bits/stdc++.h> using namespace std; inline int read() { , f = ; char ch = getchar(); ; ch = getchar(); } + ch - ; ch = getchar(); } return x * f;…
那天晚上刚好有事就咕了. 最近的那一场E题还不会写.F题全场又只过了三个?留坑吧... A - Biscuit Generator #include <cstdio> using namespace std; inline int read() { , f = ; char ch = getchar(); ; ch = getchar(); } + ch - ; ch = getchar(); } return x * f; } int main() { int a = read(), b =…
总的来说,这次的题目比较水,然而菜菜的我并没有把所有题目都做完,话不多说,直接来干货: A:Next Alphabet 题目链接:https://atcoder.jp/contests/abc151/tasks/abc151_a 题目描述:Given is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order. 大致解读:给你一个小写字母,输出这个小写字母…
点此进入比赛 \(A\):XOR Circle(点此看题面) 大致题意: 给你\(n\)个数,问是否能将它们摆成一个环,使得环上每个位置都是其相邻两个位置上值的异或值. 先不考虑\(0\),我们假设环上第一个数是\(a_1\),第二个数是\(a_2\),则第三个数\(a_3=a_1\ xor\ a_2\),第四个数\(a_4=a_2\ xor\ a_3=a_1\)... 以此类推,也就是说,一个合法的环上必然是\(a_1,a_2,a_1\ xor\ a_2\)三者重复. 整理一下,就是要满足:…
题目链接 题意就是给N根火柴,M个数(M只能是1到9,对应的数字也只能是1到9),只能用这M个出现过的数(但每个数可以随便用多少个,只要火柴够)来拼出一个数字(拼出1,2,3,4,5,6,7,8,9分别要用2,5,5,4,5,6,3,7,6根火柴),要求最大能拼出多大的数. 就是完全背包嘛,要是数字更大,数字长度必是首先要考虑的,再其次才是首位的数字大小. dp[i]表示由i根火柴能拼出的数字的最大长度,match数组就是上面那个对应关系,k表示要加上哪个数字, match[k]就是要这个数字需…
题目链接 题意就是要让给出的数字去互相取余,看看能得到最小的数事多少. 那么就可以从小到大排序,每一次都贪心地把最小的数作为攻击者,去攻击其他的数字(也就是大的取余小的),然后再一次排序,循环这个过程,直到出现1或者数字只剩一个非0数. 代码如下 #include <cstdio> #include <algorithm> using namespace std; ]; int main() { int n; scanf("%d", &n); ; i &…
A: B +/- A 签到题. B: Foods Loved by Everyone 签到题. C: Monsters Battle Royale 怪物的血量一直两两相减,类似于辗转相减法. 可以证明,最后存活怪物血量最小值即为所有怪物初始血量的 \(gcd\) . D: Match Matching 考虑 \(dp\) 预处理一个数组 \(f\) , \(f[i][j]\) 表示第一位用数字 \(i\) ,后面一共用 \(j\) 根火柴棒,能拼出数字的最大位数. 一共有 \(nm\) 个状态,…
点此进入比赛 \(A\):><(点此看题面) 大致题意: 给你一个长度为\(n-1\).由\(<\)和\(>\)组成的的字符串,第\(i\)位的字符表示第\(i\)个数和第\(i+1\)个数的大小关系,求这个由非负整数组成的数组中元素和的最小值. 送分题都想了几分钟才做出来,真是退役预警...... 显然,对于所有小于两旁的数,我们给它赋值为\(0\),然后再从它们向两边扩展即可. #include<bits/stdc++.h> #define Tp template&…
点此进入比赛 \(A\):Connection and Disconnection(点此看题面) 大致题意: 给你一个字符串,将它重复\(k\)次.进行尽量少的操作,每次修改一个位置上的字符,使得不存在两个相邻位置上字符相同.求最少操作次数. 一个很\(naive\)的想法,就是将原串直接扫一遍,遇到与前一位相同的字符,就修改这一位字符为一个不存在的字符,并将计数器加\(1\).最后将计数器乘上\(k\). 然后,比较此时串首与串尾是否相同(注意是此时,因为上面操作中可能会修改串尾),如果相同,…
A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contest, AtCoder Beginner Contest, is abbreviated as ABC. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example,…
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E869120's and square1001's 16-th birthday is coming soon.Takahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces. E869…
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder Beginner Contest 052 A题意: 输出大的面积? 思路: max(A*B,C*D); AtCoder Beginner Contest 052 B题意: 枚举过程,然后...太水了.. AtCoder Beginner Contest 052 C题意: 输出N!的因子个数mod1…
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) oth…
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; cout &…
AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) \[x=i,g(x)=0\] \[x\ne i ,g(x)=1\] 则我们可以构造 \[f(x)=\sum^{i=0}_{P-1}(-a_i*(x-i)^{P-1}+a_i)\] 对于第\(i\)条式子当且仅当\(a_i=1 \ and \ x=i\)时取到\(1\) 代码写的比较奇怪 const…
A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takahashi is a user of a site that hosts programming contests.When a user competes in a contest, the rating of the user (not necessarily an integer) changes…
AtCoder Beginner Contest 079 D - Wall Warshall Floyd 最短路....先枚举 k #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ][]; int H, W, A, ans; int main() { scanf("%d%d", &H, &a…
AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N consisting of ( and ). Your task is to insert some number of ( and ) into S to obtain a correct bracket sequence.Here, a correct bracket sequence is def…
AtCoder Beginner Contest 075 D - Axis-Parallel Rectangle 我要崩溃,当时还以为是需要什么离散化的,原来是暴力,特么五层循环....我自己写怎么都错.....暴力都不会了,,,,, #include<iostream> #include<vector> #include<limits> #include<algorithm> using namespace std; typedef long long l…
AtCoder Beginner Contest 075 C bridge 桥就是指图中这样的边,删除它以后整个图不连通.本题就是求桥个数的裸题. dfn[u]指在dfs中搜索到u节点的次序值,low[u]指dfs栈中u能追溯到的最早栈中节点从次序号.这里写的很好. #include<bits/stdc++.h> using namespace std; ; vector<int> G[maxn]; int dfn[maxn],low[maxn]; int n,m,u,v,dep,…
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one…