2 条题解

  • 0
    @ 2022-11-30 15:20:24

    #include<bits/stdc++.h>

    using namespace std;

    int main(){

    int n,i,j,len;
    bool b[101]={0};
    char a[101];
    cin>>n;
    len=n;
    for(i=1;i<=n;i++){
    	cin>>a[i];
    }
    for(i=1;i<=n;i++){
    	if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='y'){
    		if(a[i+1]=='a'||a[i+1]=='e'||a[i+1]=='i'||a[i+1]=='o'||a[i+1]=='u'||a[i+1]=='y'){
    			b[i+1]=1;
    			continue;
    		}
    	}
    }
    for(i=1;i<=n;i++){
    	if(b[i]==0){
    		cout<<a[i];
    	}
    }
    return  0;
    

    }

    • 0
      @ 2022-8-12 19:41:14

      暴力枚举

      /*****************************************
      Note  :
      ******************************************/
      #include <queue>
      #include <math.h>
      #include <stack>
      #include <stdio.h>
      #include <iostream>
      #include <vector>
      #include <iomanip>
      #include <string.h>
      #include <algorithm>
      #define LL long long
      #define IL inline
      const int N = 1e6+10;
      const int INF = 0x3f3f3f3f;
      using namespace std;
      IL int read()
      {
          char ch = getchar();
          int f = 1, num = 0;
          while(ch>'9'||ch<'0')
          {
              if(ch=='-') f = -1;
              ch=getchar();
          }
          while(ch>='0'&&ch<='9')
              num = num*10+ch-'0', ch = getchar();
          return num*f;
      }
      string s;
      char last='.';
      bool check(char x)
      {
          return x=='a'||x=='e'||x=='i'||x=='o'||x=='u'||x=='y';
      }
      int main()
      {
      	read(),cin>>s;
      
      	for(int i = 0;i<s.size();i++)
          {
              if(!check(s[i])||!check(last))
                  putchar(s[i]),last=s[i];
          }
      }
      
      • 1

      信息

      ID
      2313
      时间
      1000ms
      内存
      256MiB
      难度
      4
      标签
      递交数
      28
      已通过
      18
      上传者