杂题
穷源溯流
路很长,尽管走便是。
展开
-
SGU 486. “Bulls and Cows“
输入两个 4 位数,如果对应位置的数相同 bull++,如果对应位置不同但是在另一个数中的某一位与其相同 cow++ 输出 bull cow int main() { //IOS; int *a=new int [5]; int *b=new int [5]; int *mp=new int [10](); for(int i=1;i<=4;i++) scanf("%1d",a+i),mp[a[i]]++; int bull=0,cow...原创 2020-11-07 08:29:21 · 143 阅读 · 0 评论 -
Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) A. Kids Seating(构造+数学)
有 n 个小朋友,4n 个座位,每个座位的编号从 1~4n ,那么任意两个小朋友坐在 a,b 座位,当 gcd(a,b) != 1 gcd(a,b) != a 且 gcd(a,b) != b 所以,要求你对小朋友进行安放,任意输出答案 int main() { //IOS; rush() { cin>>n; int ans=4*n; for(int i=1;i<=n;i++){ ...原创 2020-11-03 08:20:09 · 229 阅读 · 0 评论 -
Educational Codeforces Round 97 (Rated for Div. 2) D. Minimal Height Tree(BFS 思想)
#pragma GCC optimize(2) #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <cstdio> #include <algorithm> #include <cstring> #include <queue> #include <vector> #include <utility> #in.原创 2020-10-28 22:51:31 · 168 阅读 · 0 评论 -
Codeforces Round #677 (Div. 3) C. Dominant Piranha
给出 n 个数,若 a[i] 大于 a[i-1] 或 a[i+1] 那么他可以吃掉与他相邻的比他小数,并且自身的值 +1,且被吃掉的数消失,问是否存在一个这样的数,可以将出他以外所有数吃掉 数组中最大值的两边若存在一个比他小的即可完成过程 const int N=3e5+5; int n,m,t; int i,j,k; int a[N]; int main() { //IOS; rush(){ sd(n); ...原创 2020-10-21 12:42:06 · 268 阅读 · 0 评论 -
A.Three Friends
#include <iostream> #include <algorithm> #include <cstring> using namespace std; typedef long long ll; const int idata=1e5+5; const ll inf=1e15+5; const int mod=10; //ll dp[idata];...原创 2020-03-02 18:02:51 · 288 阅读 · 0 评论 -
A. Donut Shops
int main() { IOS; rush(){ ll a,b,c; cin>>a>>b>>c; if(a>=c) cout<<-1<<" "<<b<<endl; else{ cout<<1<<" "; ...原创 2020-06-26 14:24:35 · 368 阅读 · 0 评论