Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:各位高手帮帮忙看看,两个代码,一个ac,一个wa,用cin ac,用scanf就wa,超郁闷的问题

Posted by smlq123 at 2016-07-09 23:07:41 on Problem 3044
In Reply To:各位高手帮帮忙看看,两个代码,一个ac,一个wa,用cin ac,用scanf就wa,超郁闷的问题 Posted by:scauben0 at 2006-10-26 09:19:04
> 两个代码,一个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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator