标签:main using std string algo ++ int define cpp
#include <iostream> #include <algorithm> #include <cmath> #include <map> #include <cstdio> #include <sstream> #include <cstring> #include <cctype> using namespace std; #define maxn 3000 int main() { string s; cin >>s; float ans = 0; int flag =1; if(s[0]== ‘-‘) flag =0; for(int i= s.size()-1;i>=0;i--) if((s[i]-48)==2) ans++; if(flag) ans = ans/s.size(); else ans = (ans/(s.size()-1))*1.5; if((s[s.size()-1]-48 )%2 ==0 ) ans *=2; printf("%.2f%%",ans*100); return 0; }
标签:main using std string algo ++ int define cpp
原文地址:https://www.cnblogs.com/TigerDZ/p/11722019.html