Home > OI > Sgu 276

Sgu 276


水题一道,分析好情况就行了(注意p<=0的情况)

1 #include<stdio.h>
2 #include<stdlib.h>
3 int main()
4 {
5     int s,p,ans=0;
6     scanf(“%d%d”,&s,&p);
7     p-=s;
8     if(p>0)    ++ans;
9     if(p>=300) ++ans;
10     if(p>=900) ++ans;
11     if(p>=1800)++ans;
12     printf(“%d\n”,ans);
13     return 0;
14 }
15
Categories: OI
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: