这次CF还是老样子,以我的水平只能做做水题,不过手速比前几次快了些......希望以后越来越快^_^
A题:看完啰嗦的题意就清楚了,两个循环,统计主队服装与客队服装的相同数......
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n;
int home[50],away[50];
int main()
{
while(cin >> n)
{
for(int i=0; i<n; i++)
{
cin >> home[i] >> away[i];
}
int cnt = 0;
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
if(j != i && home[i] == away[j])
{
cnt++;
}
}
}
cout << cnt << endl;
}
return 0;
}
B题:一串密码,问最多需要按多少次按钮才能猜对。如果猜对当前一位,则继续;如果猜错,则回到初始位置。
When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button
that goes next in the sequence), or all pressed buttons return to the initial position. When all buttons are pressed into the lock at once, the lock opens.
列几个简单的例子就找到规律了
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int n;
while(cin >> n)
{
int sum = 0;
for(int i=1; i<=n; i++)
{
sum += i * (n-i);
}
sum += n;
cout <<sum <<endl;
}
return 0;
}
C题:在一个给定长宽的平面中,找到最长的整数点序列,使得任意两个点之间距离不为整数。
两个整数点最短的非整数距离为根号2,横纵坐标相差1。这样依次找出的点一定符合要求。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n, m;
int main()
{
while(cin >> n >> m)
{
int k = min(n,m)+1;
cout <<k <<endl;
for(int i=0; i<=k-1; i++)
{
cout <<i <<' ' << k-i-1 <<endl;
}
}
return 0;
}
分享到:
相关推荐
#include using namespace std; int main(){ int n,k,i,x,ans=0,q[20]; cin>>n>>k; for(i=1;i;++i){ cin>>x; q[4]=0; q[7]=0; while(x) { ++q[x]; x/=10; } if(q[4]+q[7])++ans; } ...}
codeforce701B题
解决问题的方法教育Codeforces回合101 - 2/6 常规托架顺序-接受红色和蓝色-接受Codeforces回合#686(Div.3) 2/6 特殊排列-接受唯一出价拍卖-接受序列转换-接受编号成序列-接受Codeforces回合#685(分区2) 2/7 减...
codeforce700B题
codeforce 701A题
codeforce700A题
Codeforce:针对第2分部的Codeforce的每一轮解决方案的说明
CodeForce 比赛# 标题解决方案25 一种 27 一种 320 乙 429 一种 586 C 608 C 615 C 624 C 626 一种 640 G 654 C 669 乙 愚人节d Croc_Champ_R2 乙
codeforce Rudolf and the Another Competition的C语言写法(用了sort)
_我解决的Codeforce问题的解决方案_ Python解决方案 一个 4 69 281 344 546 630 749 791 977 1196 1223 1433 C语言解决方案 一个 4 69 344 546 630 705 749 791 977 1223 C ++解决方案 一个 4 ...
我在Codeforce上解决的一些问题:) 使用的CPP模板: //作者:Dipjoy Basak // dip_10 使用命名空间std #include ; #define endl“ \ n” #define ll long long #define ld long double #define pb push_back #...
码力Codeforce解决方案
CodeForce 我提出的Codeforce问题
CodeForces问题解决方案:Codeforce问题解决方案。 专注于动态编程,数据结构,数论,图算法,二进制搜索
Codeforce:针对Codeforce上各种挑战的解决方案
程式设计有关Codeforce中存在的问题的C ++代码
CODEFORCE问题集解决方案
codeforces:Codeforce问题
codeforce_solutions:这是我的Codeforce练习集解决方案存储库