#include<bits/stdc++.h> usingnamespacestd; #definepb push_back #defineendl'\n' #defineLL long long constintN =5e5+10; intn, a[N], l[N], r[N]; LL pre[N], suf[N], b[N]; voidsolve(){ cin >> n; for(inti =1; i <= n; i++) { cin >> a[i]; b[i] = a[i]...
题解:AtCoder Beginner Contest 189 C - Mandarin Orange 提供一种不一样的 O(nlogn)O(nlogn) 的方法。 设对于第 ii 个位置,左边第一个大于它的位置记为 LiLi ,右边第一个大于它的位置记为 RiRi。 发现对于第 ii 个位置的值作为 xx 时的最优解即为 (Ri−Li−1)×vali(Ri−Li−1)×...
思路:看数据n只有1e4,所以暴力是能过的,O(n^2)哎气气! #include<bits/stdc++.h>using namespace std;const int maxn=1e4+100;int a[maxn];int main(){int n,i,j,l,r;cin>>n;for(i=1;i<=n;i++){cin>>a[i];}int ans=-INT_MAX;for(i=1;i<=n;i++){int mm=INT_MAX;for(j...
第一次参加 AtCoder 的比赛,感觉还挺简单。 比赛链接:https://atcoder.jp/contests/abc189 A - Slot // Author : RioTian // Time : 21/01/23 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 10; int main() { // freopen("in.txt","r",std...
1026 A - Two Regular Polygons GNU C++17 geometry greedy math number theory *800 Apr/17/2023 17:09 1025 B - Young Explorers GNU C++17 dp greedy sortings *1200 Apr/16/2023 15:49 1024 B - JoJo's Incredible Adventures GNU C++17 math strings two pointers *1100 Apr/15/2023 18:51 1023...
1#include <iostream>2#include <vector>3#include <algorithm>4#include <queue>5#include <vector>6#include <cstdlib>7#include <cstring>8usingnamespacestd;9intn,x,v,p;10intmain(void)11{12cin>>n>>x;13x*=100;14for(inti=1;i<=n;++i)15{16cin>>v>>p;17x-=v*p;18if(x<0)19{20cou...
原题链接 思路# 从头开始遍历比较与xx的大小即可 注意浮点数判断大小的精度问题 AC代码# Copy#include<bits/stdc++.h> using namespace std; typedef long long LL; const int N=2e5+10; const LL mod=1e9+7; double v[N],p[N]; int main() { int n; double x; scanf("%d%lf",&n,&x); ...
AtCoder Beginner Contest 189 回家打的第一把,有点拉。 A-Slot 判断一个字符串中字符是不是都是一样的,没什么好说 B-Alcoholic 每瓶酒的容量和浓度为vi和pi,摄入x的时候喝醉。依次喝下每瓶酒,问是否喝醉/第几杯醉。模拟一下即可,注意用浮点数的时候有精度误差。
[ABC189] AtCoder Beginner Contest 189 Tasks Task Name Time Limit Memory Limit A Slot 2 sec 1024 MB Submit B Alcoholic 2 sec 1024 MB Submit C Mandarin
AtCoder Beginner Contest 189 Personal Editorial 第一次参加 AtCoder 的比赛,感觉还挺简单。 比赛链接:https://atcoder.jp/contests/abc189 A - Slot // Author : RioTian// Time : 21/01/23#include<bits/stdc++.h>usingnamespacestd;typedeflonglongll;constintN =1e5+10;intmain(){// freopen("in...