L1-017. 到底有多二
来源:互联网 发布:淘宝店铺流量太少 编辑:程序博客网 时间:2024/05/16 10:43
//AC
#include <iostream>#include <cstdlib>#include <stdio.h>#include <algorithm>#include <math.h>#include <string.h>#include <queue>#include <stack>#include <vector>#include <map>#include <set>typedef long long ll;using namespace std;int main(){ string s; float sum; int k; cin>>s; if(s[0]=='-'){ k=0; for (int i=1; i<s.size(); i++) { if(s[i]-'0'== 2){ k++; } } sum=(k*1.5)/(s.size()-1); if(s[s.size()-1]%2==0){ sum=sum*2.0; } } else{ k=0; for (int i=0; i<s.size(); i++) { if(s[i]-'0'== 2){ k++; } } sum=(k*1.0)/s.size(); if(s[s.size()-1]%2==0){ sum=sum*2.0; } } sum=sum*100; printf("%.2f",sum);cout<<"%"<<endl; return 0;}
0 0
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二
- L1-017. 到底有多二 Java
- PAT L1-017. 到底有多二
- 深度| 百度副总裁王海峰:百度在NLP领域都做了什么?
- OpenVAS – Status code: 503, Status message: Service temporarily down
- IUnknown
- C++设计模式——单例模式
- CentOS 7 上systemctl 的用法 【转】
- L1-017. 到底有多二
- Ubuntu与CentOS的区别
- 为知一而学十,人生而孤独
- 数据库权限分配探讨
- 读《富爸爸穷爸爸》
- 矩形覆盖问题
- jsp:userBean所使用的Bean属性要小写
- MySql5.6安装之centoOs6.5
- 感知机算法原理(PLA原理)及 Python 实现