#include<bits/stdc++.h>using namespace std;int main(){    long long a,b;    cin>>a>>b;    a--;    long long tmp=a;    if(tmp&1)        tmp=0;    long long tot=a;    if(tot%4==1||tot%4==2)        tot=1;    else        tot=0;    long l…
把每个数字每一位上二进制数字取出,求答案时直接用N个数里这一位是0的个数乘上这一位是1的个数然后乘上二的这一位次方,注意所有可能溢出的地方都要对mod取模. #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; ][]; ],sum1[],presolve[]; ; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(…
#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…
#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;int n;int a[1007][1007],t[1007],p[1007];queue<int>q[2];//每次把消去的选手扔进队列,避免无法消去的选手被频繁访问,暴力模拟会N^3复杂度,只对新的选手进行遍历大概只有N^2复杂度int main(){ cin>>n; for(int i=1;i<=n;++i) for(…
思路统计最大值出现的次数,和最小值出现的次数.虽然是每次都是MAX-MIN,我们先求MAX的和,然后再求MIN的和,做差. 这次代码写的真的很漂亮 题目地址: #include <bits/stdc++.h> using namespace std; template <typename t> void read(t &x) { char ch = getchar(); x = 0; t f = 1; while (ch < '0' || ch > '9') f…
Tasks - AtCoder Beginner Contest 254 D - Together Square 题意: 给定一个N,找出所有不超过N的 ( i , j ),使得( i * j )是一个平方数. 题解: 首先要知道一个数学只是,如果i*j是平方数,那么i*j /(f(i)*f(j))也是平方数  (f(j)表示的是j的不超过j的最大平方数因子),然后因为i/f(i)一定可以被质数 p分割两次或更多,所以得到 i/f(i)=j/f(j)) #include<bits/stdc++.…
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…
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…
A - Libra 题目链接:https://abc083.contest.atcoder.jp/tasks/abc083_a Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is…