题目大意: 一开始第一行是 1,第二行是2 4 ,第三行是3 5 7 9 ,类似这样下去,每一行的个数是上一行的个数,然后对这些点从第一个进行编号,问你从[l,r]区间数的和. 思路:分别求出奇数和偶数的个数.然后开始暴力.居然过了== 公式;前m个奇数的和是(m^2),前m个偶数的和是(m*(m+1)). #include<bits/stdc++.h> using namespace std; #define int unsigned long long #define mod 100000…
A. Far Relative's Birthday Cake 题意: 求在同一行.同一列的巧克力对数. 分析: 水题~样例搞明白再下笔! 代码: #include<iostream> using namespace std; const int maxn = 105; char a[maxn][maxn]; int main (void) { int N;cin>>N; int cnt = 0, res = 0; for(int i = 0; i < N; i++){ cn…
#include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f3f3f #define int long long ]; signed main(){ int n,k; cin>>n>>k; string str; cin>>str; map<int,int> mp; ; ;i<str.size();i++){ if(!mp[str[i]-'A']){ mp[str[i…
最近状态极差..水题不想写,难题咬不动..哎,CF的题那么简单,还搞崩了= =.真是巨菜无比. Codeforces777A 题意:略. 思路: 构造出3!次变换,然后输出就好. Code: #include <bits/stdc++.h> using namespace std; int a[6][4]={{1,2,3},{2,1,3},{2,3,1},{3,2,1},{3,1,2},{1,3,2}}; int main() { int n,x; scanf("%d",&…
具体思路已经在代码注释中给出,这里不再赘述. #include<iostream> #include<algorithm> using namespace std; int t; string s; int main() { cin >> t; while(t--) { cin >> s; int len = s.size(); int total0 = 0, total1 = 0; for(int i = 0; i < len; i++) { tot…
题目链接:Codeforces Round #367 (Div. 2) C. Hard problem 题意: 给你一些字符串,字符串可以倒置,如果要倒置,就会消耗vi的能量,问你花最少的能量将这些字符串排成字典序 题解: 当时1点过头太晕了,看错题了,然后感觉全世界都会,就我不会,- -!结果就是一个简单的DP, 设dp[i][0]表示第i个字符串不反转的情况,dp[i][1]表示第i个字符串反转的情况 状态转移方程看代码 #include<bits/stdc++.h> #define F(…
Codeforces Round #603 (Div. 2) A. Sweet Problem A. Sweet Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have three piles of candies: red, green and blue candies: the first pile…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis[水题] #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main(){ , s, d; scanf("%d", &n); while(n--) { scanf("%d%d", &a…
Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张卡片上都写有一个数,两个人每人选一个数,每人可以拿的卡片必须写有是自己选的数,问能否选择两个数使得两个人每人拿的卡片数一样多并且能拿光卡片.[就是看输入是不是只有两种数字] //:第一遍我看成字符串包含有选的数字也能拿,,这样写着居然过了..水题水题.. #include<cstdio> #inc…