其他分享
首页 > 其他分享> > B. Make it Divisible by 25(900)

B. Make it Divisible by 25(900)

作者:互联网

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string a;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a;
        int minn=100;
        int len=a.size();
        for(int j=0;j<len;j++){
            for(int k=j+1;k<len;k++){
                if(((a[j]-'0')*10+(a[k]-'0'))%25==0){
                    minn=min(minn,len-j-2);
                }
            }
        }
        printf("%d\n",minn);
    }
}

 

标签:std,25,900,string,Divisible,Make,int,main
来源: https://www.cnblogs.com/happycrazy/p/15798571.html