HOJ 2519 Fake coin

来源:互联网 发布:如何找数据分析项目 编辑:程序博客网 时间:2024/06/05 10:16

http://acm.hit.edu.cn/hoj/problem/view?id=2519

分成3堆

以sample in 20为例

①6 6 8

若fake在6

②2 2 2

③1 1

若fake在8

②3 3 2

③1 1 1或1 1

#include <stdio.h>#include <math.h>int main(){    int cases, n , m;    scanf("%d", &cases);    while (cases--)    {        scanf("%d", &n);        m = ceil(log(n) / log(3) );        printf("%d\n", m);    }        return 0;}