样例都过了,为啥提交就TLE了?
  • 板块P8506 标题计数
  • 楼主Kissky
  • 当前回复7
  • 已保存回复7
  • 发布时间2022/9/4 18:23
  • 上次更新2023/10/27 12:33:20
查看原帖
样例都过了,为啥提交就TLE了?
275229
Kissky楼主2022/9/4 18:23
#include<bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define re register
#define il inline
template <class T> void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9'){f|=(ch=='-');ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	x=f?-x:x;return ;
} 
int x,n;
int main()
{
	cin>>n;
	char s=getchar();
	for(re int i=1;i<=n;i++)
	{
		int pd=0,pf=0;
		s=getchar();
		while(s==' ') s=getchar();
		if(s!='#')
		{
			while(s!='\n') s=getchar();
			continue;
		}
		else
		{
			
			s=getchar();
			if(s==' ')
			{   
				pd=1;
				while(s!='\n')
				{
					s=getchar();
					if(s!=' '&&s!='\n') pf=1;
				}
			}
			else
			{
				while(s!='\n')
				s=getchar();
			}
		}		
		if(pd==1&&pf==1)
		{
		//	cout<<pf<<"            Aa         "<<i<<"       AAAAAAAAAAAA\n";
			x++;
		}
	}
	cout<<x;
	return 0;
}
//97521
2022/9/4 18:23
加载中...