A. Locked Calculator

原题链接

题解

1.如果要使用计算符号,那么一定要按等于号,也就是说,需要激活的按键至少三个
2.只激活 \(1,+,=\) 可以达到任意数
3.比较数的长度和3

code

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;

        int ans=0;
        int tem=n;
        do
        {
            ans++;
            tem/=10;
        }while(tem);
        cout<<min(3,ans)<<endl;
    }
    return 0;
}

posted @ 2024-06-18 11:47  纯粹的  阅读(47)  评论(0)    收藏  举报