/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 1ms 328.0 KiB
#3 Wrong Answer 17ms 552.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n; cin>>n;
	string s;
	cin>>s;
	int cnt = 0;
	bool a = 0, e=0,i=0,u=0,o =0;
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			if(s[i]=='a') a = 1;
			if(s[i]=='e') e = 1;
			if(s[i]=='i') i = 1;
			if(s[i]=='o') o = 1;
			if(s[i]=='u') u = 1;
			continue;
		}
		if(s[i]!=s[i-1])
		{
			
			if(s[i]=='a')
			{
				if(a) cnt++;
			}
			if(s[i]=='e')
			{
				if(e) cnt++;
			}if(s[i]=='i')
			{
				if(i) cnt++;
			}if(s[i]=='o')
			{
				if(o) cnt++;
			}if(s[i]=='u')
			{
				if(u) cnt++;
			}
		}
	}
	cout<<cnt<<endl;
}
int32_t main()
{
    int t; cin>>t;
    while(t--)
    {
    	solve();
    }
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1140 Vowel arrangement
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 09:38:32
Judged At
2024-12-09 09:38:32
Judged By
Score
1
Total Time
17ms
Peak Memory
552.0 KiB