Codeforces三道简单题

第一次使用Codeforces,.先刷三道简单题,最后附上怎么简单使用codeforces

A. Watermelon

题目链接 : Problem - 4A - Codeforces

 题面 : 

思路 : 模拟 

题解 : 

#include <stdio.h>
 
int main(int argc, char const *argv[])
{
    int n;
    scanf("%d",&n);
    if (n/2>1&&n%2==0)
        printf("YES\n");
    else printf("NO\n");
    return 0;
}

A. Array Coloring

题面 : 

 原题链接 : Problem - 1857A - CodeforcesCodeforces. Programming competitions and contests, programming communityhttps://codeforces.com/problemset/problem/1857/A

 思路 : 

就对数组中奇偶的个数进行判断就好了。

扫描二维码关注公众号,回复: 16394598 查看本文章

代码 : 

#include<iostream>
#include<cstring>
using namespace std;
int t,n,a[55];
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		int x=0,y=0;
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			if(a[i]%2!=0) x++;
			else y++;
		}
		if(x%2!=0) cout<<"NO"<<endl;
		else	 cout<<"YES"<<endl;
	}
	return 0;
}

A. Team

题面 : 

 原题链接 : Problem - 231A - Codeforces

思路 : 对于3个输入整数,统计一个个数>=2即可ans++;

代码 : 

#include<iostream>
#include<cstring>
using namespace std;
int n;
int a,b,c;
int main(){
	cin>>n;
	int ans = 0;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c;
		ans += (a+b+c>=2) ? 1 : 0;
	}
	cout<<ans<<endl;
	return 0;
}

 codeforce使用 : 

1.首先codeforces网站 : 打开百度搜索codeforces

 点击搜索出来的第一个就行了,或者直接输入网址 : Codeforces

2.注册账号 :  

 在进入codeforces界面之后,如果你之前没有注册过,那么就直接点击右上角的Register进行注册就行了,一般是邮箱注册,qq邮箱也可以!如果之前注册过,就直接点击Enter就行了!

3.题单训练 : 点击PROBLEMSET,就可以进入下面界面,请看下面的图

4.刷题 : 点击一道题,进入一道题的界面 ,比如:

 看完题目,会写了,就直接点击上面的Submit进行提交!

 在输入框中提交你的代码后,点击Submit后就提交完成了,然后等待它的测评。

等一会后,会出现下面界面 : 

accpted代表你通过了该题,然后出错的话,点击相关地方会提示你的错误!

 5.比赛 : 点击最上方的CONTESTS即可,想打哪个就点进去那个!

猜你喜欢

转载自blog.csdn.net/ros275229/article/details/132158890