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

为什么一直wa呀

Posted by Bournekkk at 2017-02-25 20:14:40 on Problem 2586
//题目大意,一个公司要么每月盈利s,要么亏损d一年每5个月发一份报告,一年8次,每次报表都显示亏损(1-5,2-6,3-7,4-8,5-9,6-10,7-11,8-12)
#include<iostream>
using namespace std;
int main()
{
	int s,d;
	int temp;
	while(cin>>s>>d)
	{
		
		for(int i=4;i>=0;i--)
		{
			if(s*i-d*(5-i)<=0)
			{
			temp=i;break;
			}
		}
		
		if(temp==4)
		{
			if(10*s-2*d>=0)
			cout<<10*s-2*d<<endl;
			else
			cout<<"Deflict"<<endl;
		}
		if(temp==3)
		{
			if(8*s-4*d>=0)
			cout<<8*s-4*d<<endl;
			else
			cout<<"Deflict"<<endl;
		}
		if(temp==2)
		{
			if(6*s-6*d>=0)
			cout<<6*s-6*d<<endl;
			else
			cout<<"Deflict"<<endl;
		}
		if(temp==1)
		{
			if(3*s-9*d>=0)
			cout<<3*s-9*d<<endl;
			else
			cout<<"Deflict"<<endl;
		}
		if(temp==0)
		{
			if(d==0)
			cout<<"0"<<endl;
			else
			cout<<"Deflict"<<endl;  
		} 
		
		
		
	}
	 
} 
//所有情况要考虑到 

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