1 import java.util.Scanner;
2
3 public class Main {
4 public static void main(String args[]){
5 double sum=0;
6 double bei=1;
7 int len;
8 int count=0;
9 String str=null;
10 Scanner in=new Scanner(System.in);
11 str=in.next();
12 len=str.length();
13 if (str.charAt(0)=='-'){
14 len=str.length()-1;
15 bei=1.5;
16 }
17 for (int i=0;i<str.length();i++){
18 if (str.charAt(i)=='2'){
19 count++;
20 }
21 }
22 int bei2=1;
23 if (Integer.parseInt(str.charAt(str.length()-1)+"")%2==0){
24 bei2=2;
25 }
26 sum=((double) count/len)*bei*bei2*100;
27 System.out.printf("%.2f%s",sum,"%");
28 }
29 }

最新文章

  1. CentOS安装gitLab服务器
  2. TensorFlow知识总结
  3. 将Controller抛出的异常转到特定View
  4. web-api-global-error-handling
  5. meteor icons &amp; splash配置
  6. 科学家有了钱以后,真是挺吓人的——D.E.Shaw的牛逼人生
  7. 你尽力了么===BY cloudsky
  8. SpringNote02.Blog系统迁移到Linux下
  9. #include &lt;boost/regex.hpp&gt;
  10. LINUX RHEL6.5字符界面安装图形化桌面
  11. Day2-字符编码转换
  12. .Net程序员学用Oracle系列(29):PLSQL 之批量应用和系统包
  13. EasyUI 冻结列
  14. (60)Wangdao.com第十天_JavaScript 函数_作用域_闭包_IIFE_回调函数_eval
  15. webpack学习笔记(五)
  16. Windows服务器
  17. 通过ALT+F9关键CALL追踪注册码
  18. 第一个python程序--hello,world
  19. MyBatis #{} 取值注意事项
  20. .NetCore WebApi利用Swagger文档实现选择文件上传

热门文章

  1. unexpected end of file while looking for precompiled header. Did you forget to add &#39;#include &quot;stdafx.h&quot;&#39; to your source 解决办法
  2. Java基础(三)——内部类
  3. Python - 进度条库 tqdm
  4. JetBrains 系列软件汉化包 2017.3-2018.1
  5. uni-app开发基本知识点
  6. PHP方法参数的那点事儿
  7. C博客作业00--顺序分支结构
  8. Java基础系列(12)- 运算符
  9. SourceTree使用详解-摘录收藏
  10. Jmeter系类(32) - JSR223(2) | Groovy常见内置函数及调用