题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2186
题解:
注意不足10人的情况,在最终结果上加上一个9,再对10取余即可解决。
AC代码:
#include <iostream>
using namespace std;
int main(){
int n, m, a, b, c;
cin >> n;
while (n--) {
cin >> m;
a = m / 2;
b = (m - a) * 2 / 3;
c = m - a - b;
cout << (a + 9) / 10 + (b + 9) / 10 + (c + 9) / 10 << endl;
}
return 0;
}