A
Sweep the answer from left to right. If it is equal to n, output n, otherwise sweep from right to left again, and then the original Add the answer to the answer
#include#include using namespace std;int a[105], n, k;int main() {cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; int ans = 0; for (int i = 1; i <= n; ++ i) {if (a[i] <= k) ++ans; else break;} if (ans == n) {cout << n << endl; return 0;} for (int i = n; i> = 1; --i) {if (a[i] <= k) ++ans; else break;} cout << ans << endl; return 0;}
B
Scan it again, if it is divisible by n, then flip the entire interval from 1 to here
#includeusing namespace std;int main(){ int n; string s; cin>>n>>s; for(int i=1;i<=n;i++) if(n%i==0) for(register int j=0;j C