| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
各位高手帮帮忙看看,两个代码,一个ac,一个wa,用cin ac,用scanf就wa,超郁闷的问题两个代码,一个ac,一个wa,用cin ac,用scanf就wa
#include<stdio.h>
#include<iostream>
using namespace std;
int stack[50010],top;
int main()
{
int n,t,i,j,x,y,ans;
scanf("%d%d",&n,&t);//换成cin>>n>>t;
top=ans=0;
for(i=0;i<n;i++)
{
scanf("%d%d",&x,&y);//换成cin>>x>>y;
if(y<stack[top-1])
{
while(y<stack[top-1])
{
top--;
}
}
if(y>stack[top-1]&&y!=0||top==0&&y!=0) {stack[top++]=y;ans++;}
}
printf("%d",ans);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator