天天看点

【微软编程一小时】题目1 : Arithmetic Expression

时间限制:2000ms

单点时限:200ms

内存限制:256mb

<dl></dl>

given n arithmetic expressions, can you tell whose result is closest to 9?

line 1: n (1 &lt;= n &lt;= 50000).

line 2..n+1: each line contains an expression in the format of "a op b" where a, b are integers (-10000 &lt;= a, b &lt;= 10000) and op is one of addition (+), subtraction (-), multiplication (*) and division (/). there is no "divided by zero" expression.

the index of expression whose result is closest to 9. if there are more than one such expressions, output the smallest index.

<dt>样例输入</dt>

<dd></dd>

<dt>样例输出</dt>

<dt>每次都很傻逼地用 == 去判断string相等,每次都吃亏都不长记性!叫你不长记性!</dt>