zoukankan      html  css  js  c++  java
  • TOPCoder(一)Time

        
    Class: Time
    Method: whatTime
    Parameters: int
    Returns: String
    Method signature: String whatTime(int seconds)
    (be sure your method is public)

    Limits

        
    Time limit (s): 2.000
    Memory limit (MB): 64

    Constraints

    - seconds will be between 0 and 24*60*60 - 1 = 86399, inclusive.

    Examples

    0)  
        
    0
    Returns: "0:0:0"
     
    1)  
        
    3661
    Returns: "1:1:1"
     
    2)  
        
    5436
    Returns: "1:30:36"
     
    3)  
        
    86399
    Returns: "23:59:59"
     

    This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.  

    第一个使用平台,感觉有点懵了。题目跟一般的也不一样。

    ACcode:

    import java.util.Scanner;
    
    public class Time {
    
    	public String whatTime(int seconds){
    		
    		
    		int h = seconds/(60*60);
    		seconds = seconds - h*(60*60);
    		int m = seconds/60;
    		seconds = seconds - m*60;
    		int s = seconds;
    		
    		return h+":"+m+":"+s;
    	}
    	public static void main(String[] args) {
    		Scanner cin = new Scanner(System.in);
    		Time time = new Time();
    		int seconds = cin.nextInt();
    		System.out.println(time.whatTime(seconds));
    	}
    }
    

    第一次在这上面做题。

  • 相关阅读:
    2019 ICPC Asia Nanchang Regional E Eating Plan 离散化+前缀和
    2018icpc南京/gym101981 G Pyramid 找规律
    2018icpc沈阳/gym101955 J How Much Memory Your Code Is Using? 签到
    2018icpc南京/gym101981 K Kangaroo Puzzle 随机化
    series_02
    series_01
    locust_参数化关联
    locust_关联
    locust_单接口
    截图处理
  • 原文地址:https://www.cnblogs.com/lzeffort/p/4770673.html
Copyright © 2011-2022 走看看