蓝桥杯
2020年
F
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <bits/stdc++.h> using namespace std; string str; int judge(char ch){ if(ch == 'a' || ch == 'e' || ch == 'i'|| ch == 'o' || ch == 'u') return true; return false; } int main(){ ios::sync_with_stdio(0); while(cin >> str) { int cnt = 1; int flag = 0; for (int i = 0; i < str.size(); i++) { //上一个是辅音 这一个是元音 if (judge(str[i]) && !flag) { cnt++; flag = 1; } //上一个是元音,这一个是辅音 if (flag && !judge(str[i])) { cnt++; flag = 0; } } if (cnt == 4) cout << "yes"; else cout << "no"; cout << endl; } return 0; }
7 螺旋矩阵
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <bits/stdc++.h> using namespace std; int n,m; const int maxn = 1010; int dp[maxn][maxn]; int main(){ cin >> n >> m; int i = 1,j = 1,num = 1; dp[i][j] = 1; while(num < n * m){ while(j < m && !dp[i][j + 1]) dp[i][++j] = ++num; while(i < n && !dp[i + 1][j]) dp[++i][j] = ++num; while(j > 1 && !dp[i][j - 1]) dp[i][--j] = ++num; while(i > 1 && !dp[i - 1][j]) dp[--i][j] = ++num; } for(i = 1; i <= n; i++){ for(j = 1; j <= m; j++) cout << dp[i][j] << " "; cout << endl; } return 0; }