UVa 11780 – Miles 2 Km

#include <iostream>
#include <stdio.h>

using namespace std;

/*
  diff
  5 : 0.0
  3 : 0.2
  2 : 0.2
  1 : 0.4
  */

  int main (){
  	int n;
  	while (cin>>n){
  		if (n == 0 )break;
  		n = n%5;
  		switch (n){
  			case 0:cout<<"0.00"<<endl;break;
  			case 1:cout<<"0.40"<<endl;break;
  			case 2:cout<<"0.20"<<endl;break;
  			case 3:cout<<"0.20"<<endl;break;
  			case 4:cout<<"0.40"<<endl;break;
  		}

  	}
  	return 0;
  }

Advertisements

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