/images/avatar.png

^_^

每日一题 (X)

堆 贪心 题目 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #include<bits/stdc++.h> using namespace std; using ll = long long; ll n; struct p{ ll v,s; }ps[100005]; bool cmp(p a,p b){return a.s>b.s;} priority_queue<ll , vector<ll> , greater<ll> > pq; int main(){ cin>>n; for(ll i=0;i<n;i++) cin>>ps[i].v>>ps[i].s; sort(ps,ps+n,cmp);

abc168

A - ∴ (Therefore) 题意 看题目 题解 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; char c=s[s.length()-1]; switch(c){ case '2' :case '4': case '5': case '7': case '9': cout<<"hon\n"; break; case '3': cout<<"bon\n"; break; default :cout<<"pon\n"; } return 0; } B - … (Triple Dots) 题意 看

abc167

这个比赛尽犯些sb错🙃,先是把 j 写成 i ,然后把2E5写成1E5 A - Registration 题意 判断字符串T是不是S后加一个字符 题解 1 2 3 4 5 6 7 8 9 10 #include<bits/stdc++.h> using namespace std; using ll

牛客算法周周练5(部分)

C - 序列最小化 题解 贪心,每次选择的长度为k的区间首尾重叠 1 2 3 4 5 6 7 8 9 10 11 #include<bits/stdc++.h> using namespace std; using Int = long long; int main(){ Int n,k; cin>>n>>k; n-=k; Int ans = ceil((double)n/(k-1)); cout<<ans+1<<endl; return 0; } E - 简单瞎搞题 题

git

git安装 用户名和邮箱 初始化或切换用户名和邮箱 git config --global user.name "XXX" git config --global user.email "XXX" 查看当前用户名和邮箱 git config --global user.name git config --global user.email 查看用户名和邮箱列表 git config --list 删除用户名和

abc166

A - A?C 题意 abc输出arc反之亦然 题解 1 2 3 4 5 6 7 8 9 #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; s[1]=s[1]=='B'? 'R': 'B'; cout<<s<<endl; return 0; } B - Trick or Treat 题意 snack_i被snuke_1,snu

abc165

A - We Love Golf 题意 询问在A到B之间是否有C的倍数 题解 特判边界是否满足条件,否则判断左右边界除以C的值是否大于等于1 ac代码 1 2 3 4 5 6 7 8 9 10 11

abc164

A - Sheep and Wolves 题意 判断两个数的大小 题解 ac代码 1 2 3 4 5 n,m = map(int,input().split()) if n>m: print('safe') else : print('unsafe') B - Battle 题意 给定两个人的生命值和攻击力,两个人回合制battle,谁的生

NC17134

Symmetric Matrix 题目描述 Count the number of n x n matrices A satisfying the following condition modulo m. Ai, j ∈ {0, 1, 2} for all 1 ≤ i, j ≤ n. Ai, j = Aj, i for all 1 ≤ i, j ≤ n. Ai, 1 + Ai, 2 + … + Ai, n = 2 for all 1 ≤ i ≤ n. A1, 1 =