Atcoder Beginner Contest 155E(DP)】的更多相关文章

#definde HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>s+; ); ; for(int i=n;i;--i){ ]<') ans+=s[i]-'; else{ ans+=-(s[i]-'); ++s[i-]; } } ])…
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…
D - "redocta".swap(i,i+1) 题意: 给一个字符串,每次交换相邻两个字符,问最少多少次变成"atcoder" 题解: 从左到右依次模拟 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; const int N=2e5+5; const ll inf=1e18; const ll mod=9…
#include<bits/stdc++.h>using namespace std;int a[200007];int b[200007];long long dp[200007];long long sum[200007];const long long mod =1e9+7;int main(){    dp[0]=1;    int n;    scanf("%d",&n);    for(int i=1;i<=n;i++)        scanf(…
#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…
#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]…