2021CCPC中国大学生程序设计竞赛女生专场 K 音乐游戏

2021/11/6 1:11:45

本文主要是介绍2021CCPC中国大学生程序设计竞赛女生专场 K 音乐游戏,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

题目链接

题目描述

在这里插入图片描述
在这里插入图片描述

解题思路

这是一个签到题,只要统计_的个数就行了

代码:

#include<iostream>
#include<stdio.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
const int maxn = 1e5+7;
const int mod = 1e9+7;
#define ll long long
int a[15];
int b[15];
int main(){
//	freopen("in.txt","r",stdin);
	int n;scanf("%d",&n);
	getchar();
	int cnt=0;
	while(n--){
		string str;
		getline(cin, str);
		//cout<<str<<endl;
		for(int i=0;i<str.size();i++){
			if(str[i]=='-')cnt++;
		}
	}
	printf("%d\n", cnt);
}



这篇关于2021CCPC中国大学生程序设计竞赛女生专场 K 音乐游戏的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程