⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1326.txt

📁 北大ACM题目例程 详细的解答过程 程序实现 算法分析
💻 TXT
字号:


//////////////////////////////////////////////////
//Mileage Bank
//
//

#include"stdio.h"

int main()
{
	char city1[100], city2[100], type;
	int total, distance;
	
	while( 1 )
	{
		total = 0;
	
		while( 1 )
		{
			scanf( "%s", city1 );
			
			if( ( city1[0] == '0' || city1[0] == '#' ) && city1[1] == '\0' )
				break;
			
			scanf( "%s %d %c", city2, &distance, &type );
		
			switch ( type )
			{
				case 'F' : total += distance * 2; break;
				case 'B' : total += distance + ( distance + 1 ) / 2; break;
				default  : total += ( distance < 500 ) ? 500 : distance; break;
			}	
		}
		
		if( city1[0] == '#' ) break;
		printf( "%d\n", total );
	}

	return 0;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -