#include<iostream> #include<cstdio> using namespace std; int main(){ int n,sum,s[15],t[15]; while(scanf("%d",&n)&&n!=-1){ for(int i=1;i<=n;i++){ scanf("%d%d",&s[i],&t[i]);
#include<iostream> #include<cstdio> using namespace std; int main(){ int n,x,y; scanf("%d",&n); while(n--){ scanf("%d%d",&x,&y); if(x>=y)printf("MMM BRAINS\n");
#include<iostream> #include<cstdio> using namespace std; int main(){ int n,sum,i,j,t; while(scanf("%d",&n)&&n){ i=1; while(i*(i+1)/2<n)i++; i--; sum = 0; for(j=1;j<=i;
#include<iostream> #include<cstdio> using namespace std; int main(){ int n; while(scanf("%d",&n)==1){ int k = 1; while(k*(k+1)/2<n)k++; k--; int t = n-k*(k+1)/2; k++; if(
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char s[100005],t[100005]; int main(){ while(scanf("%s%s",s,t)==2){ int i,j,lens = strlen(s),lent = strlen(t); for(i=0,j=0;i<lens&
#include<iostream> #include<cstdio> using namespace std; #define PI 3.1415927 int main(){ double d,r,t,ansl,ansspd; int kase = 1; while(scanf("%lf%lf%lf",&d,&r,&t)==3&&r!=0){ ansl = PI*d*r/12/5
#include<iostream> #include<cstdio> /* PERFECTION OUTPUT 15 DEFICIENT 28 PERFECT 6 PERFECT 56 ABUNDANT 60000 ABUNDANT 22 DEFICIENT 496 PERFECT END OF OUTPUT */ using namespace std; int main(){ int i,j,k,a[105],s[1
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int main(){ char a[100],b[100],f[2],tmp[100]; int m,sum; sum = 0; while(true){ scanf("%s",tmp); if(!strcmp(tmp,"#&q
呀~不知不觉都已经到集训的第二期了呢,感觉两天假期过得好快啊(悲)。 今天主要是在刷学长给的搜索题(共有19道),今天总共刷了7道题,加上之前做的两道,这个搜索题场也能说刷了过半了吧,今天主要挑的都是一些简单的水题,感觉没什么营养,剩下的题对我来说都是有一定
P1168 中位数 记录当前中位数,维护一个大根堆存储小于中位数的数,一个小根堆存储大于等于中位数的数。 当需要输出中位数时,比较一下两个堆的大小,如果差值为 \(2\),则将当前中位数扔进数较少的那个堆里,数较多的那个堆的堆顶取出作为新的中位数。
P1850 先用 Floyd 预处理出任意两点之间的最短路 \(\operatorname{dis}(u,v)\),然后 dp。 设 \(f_{i,j,0/1}\) 表示考虑前 \(i\) 门课,有 \(j\) 门课换教室,第 \(i\) 节课是否换教室的答案。 转移就按照第 \(i\) 次换不换与第 \(i-1\) 次换不换分类: \[\begin{cases} f_{i,j,0}=\min\{
https://leetcode-cn.com/contest/weekly-contest-102/problems/sort-array-by-parity/ 水题 我的解决方案: class Solution { public int[] sortArrayByParity(int[] A) { int[] B = new int[A.length]; int cnt=0; for(int i=0;i<A.length;i++) {
文章目录 1. 题目来源2. 题目解析 1. 题目来源 链接:3655. 楼层 2. 题目解析 没啥好说的,模拟水题。 首先第一层房间就是 1 2 编号,下面第 2~n 层每层都是 x 个房间。也就是查看 n-2 在每行 x 的方阵中的第几行,也就是上取整就行了。是从第二行开始的,最后别忘了加 1。 时间
Let’s call a positive integer
Bone Collector 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2602 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector
ACMer Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6539 Accepted Submission(s): 3086 Problem Description There are at least P% and at most Q% students of HDU are ACMers, now I want to know how many
文章目录 1. 题目来源2. 题目解析 1. 题目来源 链接:P5266 【深基17.例6】学籍管理 2. 题目解析 水题,unordered_map<> 基本使用。 代码: // https://www.luogu.com.cn/problem/P5266 #include <iostream> #include <cstdio> #include <string> #include <unordered_map>
g-7水题题解:https://vjudge.net/contest/436484#problem/G 题意为找出存在于b数组中的a数组,b数组比a数组多两个数,一个数为a数组的和,另一个数为无关的数。 我的思路一开始局限了,所以正确思路应该是将b数组先求和(记得注意数字范围),然后排序。排序之后能找到两个较大值,就又两种判断,第一种,用
c-3 水题题解 :https://vjudge.net/contest/436484#problem/C 题意为判断所给的数列能不能由题中所给要求交换数组,使之成为一个递增的数列 题目所给要求是:当存在不满足非递减的两个数组元素时,如果这两个元素的最大公约数等于数组中的最小元素,就可以交换,如果最后交换出来的数组满足
补题链接:Here 超级基本的二分 贴个代码就溜了 using ll = long long; void solve() { ll n, k; cin >> n >> k; vector<ll> a(n); for (ll &x : a) cin >> x; ll l = 1, r = 1e9, len; while (l <= r) { ll mid = l + r >&
补题链接:Here A - Number of Multiples 水题 B - An Odd Problem 水题 C - XYZ Triplets 水题,注意数组不要开小了 D - Anything Goes to Zero 这道题思路很妙: 首先计算出字符串中所有 \(1\) 的数量 \(cnt\) ,然后分三种情况: \(cnt > 1\) 此时我们不难发现对每一位的变化,模数要么
思路: 水题,略过 Tip: 无 #include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 5; int main() { long long n, m; cin >> n >> m; if(n==1) cout << 1 << endl; else if (n % 2 != 0) cout
思路: 水题,略过 Tip: 无 #include <bits/stdc++.h> using namespace std; int main() { int n, t, num = 0; string now; cin >> n >> t; getchar(); for (int i = 1; i <= n; i++) { string s; getline(cin, s);
水题~。 int main() { string s; getline(cin,s); for(int i=0;i<s.size();i++) if(s[i] == '6') { int j=i; while(j<s.size() && s[j] == '6') j++; if(
Luogu.com.cn2020年2月27日: luogu P3870 [TJOI2009]开关 线段树模板 CodeForces 1313C1 结论+模拟 CodeForces 1313A 结论 luogu P2306 被yyh虐的mzc 思维+单调队列/二进制优化多重背包 2020年2月28日: luogu P3197 [HNOI2008]越狱 容斥+排列组合+快速幂 luogu P1726 上白泽慧