Cut The Wire
题目链接: https://acm.hdu.edu.cn/showproblem.php?pid=7100
题目思路:打表找规律
题目代码:
#include <iostream>
#include <algorithm>
using namespace std;
int T, n;
int rd[] = {-1, 2, 2, 4, 3, 5, 5, 7, 7, 9, 8, 10, 10};
int main()
{
scanf("%d", &T);
while( T -- )
{
scanf("%d", &n);
if(n % 12 == 0) printf("%d\n", (n / 12 - 1) * 10 + rd[12]);
else printf("%d\n", (n / 12) * 10 + rd[n % 12]);
}
return 0;
}