P6882求调
  • 板块灌水区
  • 楼主Chtholly__Nota
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/1 23:10
  • 上次更新2024/12/2 16:58:40
查看原帖
P6882求调
847559
Chtholly__Nota楼主2024/12/1 23:10

下载了错误了的测试点,本地跑是对的╰(‵□′)╯

#include<bits/stdc++.h>
#define pn putchar('\n')
#define ps putchar(' ')
#define urd uniform_real_distribution
using namespace std;
typedef long long ll;

mt19937 rnd(114514);

template <typename T> void re(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9');
    t*=f;
}

inline void wr(ll x){
    if(x<0) x=-x,putchar('-');
    if(x>9) wr(x/10);
    putchar(x%10+'0');
}

int ans;
char x;
int n,q;
bool f,t;
int main(){
    re(n);
    f=1;
    t=1;
    while(1){
        x=getchar();
        if(t){
            if(!isupper(x)) f=0;
            t=0;
        }
        else if(x=='.' || x=='!' || x=='?'){
            if(f){
                ++ans;
                f=0;
            }
            wr(ans),pn;
            ans=0;
            --n;
            if(!n) break;
        }
        else if(x==' '){
            if(f){
                ++ans;
            }
            f=1;
            x=getchar();
            if(!isupper(x)) f=0;
        }
        else{
            if(!islower(x)){
                f=0;
            }
        }
    }
    return 0;
}
2024/12/1 23:10
加载中...