#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ; ; long long fac[N],inv[N]; long long qpow(long long a,long long b){ ; while(b){ ) ans=a*ans%mod; b>>=; a=a*a%mod; } return ans; } void P(){ fac[]=; ;i<N;i++) fac[i]…
二分,尺取法,细节模拟,尤其是要注意a[i]被计算到和a[i]成对的a[j]里时 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; int n; long long k; bool check(long long x){ ;//比x小的个数 ;i<=n;++i){ ){ long long flag=x/a[i]; if(x%a[i]){ &&a[i]<){//x…
#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;multiset<long long>mst;long long a[100007];int main(){ long long n; cin>>n; long long x; for(long long i=0;i<n;++i){ cin>>x; a[x]=i; } mst.insert(-1); mst.in…
A - Product 题目链接:https://abc086.contest.atcoder.jp/tasks/abc086_a Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even o…
D Integer Cards 题意:先给出n个数字,然后可以有m次操作,每次操作以数字对(x,y)表示最多能选x个数字把它变成y,问经历m次操作后n个数字和最大为多少? 解法:一个明显正确的做法是:用y尽量大的操作去改变数组,直到不能改变(产生负收益)为止. #include<bits/stdc++.h> using namespace std; ; int n,m,a[N]; struct dat{ int x,y; bool operator < (const dat &r…
越学越菜系列 于2020.11.2,我绿了(错乱) A - Heavy Rotation 签到题,奇数Black,偶数White. code: #include<bits/stdc++.h> #define N 10000005 #define LL long long using namespace std; int t; int a,b; inline LL qr() { LL x=0,w=1;char a=0; while(a<'0'||a>'9'){if(a=='-')w=…
A - Already 2018 题目链接:https://abc085.contest.atcoder.jp/tasks/abc085_a Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement On some day in January 2018, Takaki is writing a document. The document has a column where the curren…
A - New Year 题目链接:https://abc084.contest.atcoder.jp/tasks/abc084_a Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? Constraints 1…