文章

1

粉丝

9

获赞

0

访问

337

头像
magical string 题解:
P1896 天津大学2019年机试
发布于2023年9月15日 17:16
阅读数 337

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
	n--;
	while(n--){
		string str;cin>>str;
		int sz=str.size();int res=0;
		for(int i=0;i<sz;i++){
			if(i<sz/2&&str[i]=='<') res++;
			if(i>=sz/2&&str[i]=='>') res++;
		}
		cout<<res<<endl;
	}
	return 0;
}
				

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发