HW4.2


 import java.util.Scanner;
 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);
         int correctCount = 0;
         int answer = 0;
         int number1;
         int number2;
         long startTime = System.currentTimeMillis();
         for(int i = 0; i < 10; i++)
         {
             number1 = (int)(Math.random() * 15);
             number2 = (int)(Math.random() * 15);
             System.out.print(number1 + " + " + number2 + " = ? ");
             answer = input.nextInt();
             if(answer == number1 + number2)
                 correctCount++;
         }
         input.close();
         long endTime = System.currentTimeMillis();
         long usedTime = (endTime - startTime) / 1000;
         System.out.println("You have " + correctCount + " answers");
         System.out.println("Used time: " + usedTime);
     }
 }
HW4.2的更多相关文章
- HW4.46
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
- HW4.45
		public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ... 
- HW4.44
		public class Solution { public static void main(String[] args) { double randX; double randY; int hit ... 
- HW4.43
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
- HW4.42
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
- HW4.41
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
- HW4.40
		public class Solution { public static void main(String[] args) { long positiveSide = 0; long negativ ... 
- HW4.39
		public class Solution { public static void main(String[] args) { double sum; double baseSalary = 500 ... 
- HW4.38
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
- HW4.37
		import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ... 
随机推荐
- 一步步学习ASP.NET MVC3 (14)——Route路由
			请注明转载地址:http://www.cnblogs.com/arhat 由于今天是星期六,所以多写几篇,感觉前几天的忙碌没有及时发布文章,趁着周末老魏尽力的多写几篇文章.因为本系列基本上快结束了,所 ... 
- 常用的四种CSS样式表格
			1. 单像素边框CSS表格 这是一个很常用的表格样式. [html] <style type="text/css"> table.gridtable { font-fa ... 
- 服务器环境搭建系列(二)-Tomcat篇
			1.解压缩Tomcat的tar包,默认放在opt下 tar -zxvf apache-tomcat-6.0.35.tar.gz 2.输入如下命令修改tomcat配置文件 vi /opt/apache- ... 
- UI/UE对个性化推荐的影响
			用户界面,用户体验. 在创建网站选择色调时,大多数企业想到的是美观.其实,颜色所起到的作用远超出人们的想象. 关于颜色与购买习惯的心理学书籍比比皆是,下 ... 
- Twitter:蓄水池储水量问题
			早上买了两个饼夹肉,我吃了一个,辣椒粉好多,现在一直在实验室喝水. 一.倒数第n位 今年暑假去世纪佳缘面试,其中一题就是这个,只能遍历一遍链表求出倒数第n位. 答案是两个指针,第一个在头部设为A,第二 ... 
- C#解压、压缩RAR文件
			using System; using System.Collections.Generic; using System.Text; using System.IO; using Microsoft. ... 
- PHP漏洞全解(八)-HTTP响应拆分
			本文主要介绍针对PHP网站HTTP响应拆分,站在攻击者的角度,为你演示HTTP响应拆分. HTTP请求的格式 1)请求信息:例如“Get /index.php HTTP/1.1”,请求index.ph ... 
- UVALive 5903 Piece it together
			一开始用的STL一直超时不能过,后来发现AC的代码基本都用的普通邻接表,然后改了一下13s,T=T,效率太低了.然后把某大神,详情戳链接http://acm.hust.edu.cn/vjudge/pr ... 
- Service Oriented Architecture
			What is Service Oriented Architecture (SOA)? There have been so many interpretations of this through ... 
- hdu 2089 不要62(初学数位DP)
			http://acm.hdu.edu.cn/showproblem.php?pid=2089 题意: 给定 m,.n; 求车牌号 m~n之间 有多少数字 不含 4或62 ,8652是可以的 . ... 
