D. Tree Requests time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Roman planted a tree consisting of n vertices. Each vertex contains a lowercase English letter. Vertex 1 is the root of the…
A题: 贪心水题,注意1,1这组数据,坑了不少人 #include <iostream> #include <cstring> using namespace std; int main() { int a1,a2; while(cin>>a1>>a2) { int i=0; int b = max(a1,a2); int s = min(a1,a2); if(b==1 && s==1) { cout<<0<<endl…
A I'm bored with life 水题 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=1,M=1,MOD=1; int main() {//freopen("t.txt","r",stdin); ios::sync_with_stdio(false); LL a,b; scanf("%I64d%I64d",&…
A Mister B and Book Reading O(n)暴力即可 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=1,M=1,MOD=1; int main() {//freopen("t.txt","r",stdin); int c,v0,v1,a,l; scanf("%d%d%d%d%d",&c,&…
A Karen and Morning 水题 注意进位即可 #include<bits/stdc++.h> using namespace std; typedef long long int LL; int a,b; bool pal() { if((a%10)==(b/10)&&(a/10)==(b%10))return true; else return false; } void add() { b+=1; while(b>=60)b-=60,a+=1; whil…
A An abandoned sentiment from past 水题 #include<bits/stdc++.h> using namespace std; int a[300],b[300],n,k; bool cmp(int a,int b) { return a>b; } int main() {//freopen("t.txt","r",stdin); scanf("%d%d",&n,&k); f…