题目链接:L1-017 到底有多二 (15 分)
#include<bits/stdc++.h>
using namespace std;
int main()
{
string N;
cin>>N;
double res=0,negative=1,even=1;
double lens = N.size();
for(char s :N)
if(s=='2')res++;
if((N[lens-1]-48)%2==0)even=2;
if(N[0]=='-')
{negative=1.5;
lens--;
}
res = (res/lens)*negative*even;
cout<<setiosflags(ios::fixed)<<setprecision(2)<<res*100.00<<"%";
system("pause");
}