UVa 893 Y3K Problem (用GregorianCalendar类秒杀)

原创 2013年12月05日 12:50:30

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=834


不解释。


完整代码:

import java.util.*;
import java.io.*;

public class Main {
	static Scanner cin = new Scanner(new BufferedInputStream(System.in));

	public static void main(String[] args) {
		int n, d, m, y;
		while (true) {
			n = cin.nextInt();
			d = cin.nextInt();
			m = cin.nextInt();
			y = cin.nextInt();
			if (d == 0)
				break;
			GregorianCalendar cal = new GregorianCalendar(y, m - 1, d);//Month值是基于0的
			cal.add(Calendar.DATE, n);
			System.out.println(cal.get(Calendar.DATE) + " " + (cal.get(Calendar.MONTH) + 1) + " " + cal.get(Calendar.YEAR));
		}
	}
}

Uva 100(The 3n+1 problem) c 代码

  • 2013年06月17日 16:37
  • 569B
  • 下载

Uva 10104 Euclid Problem |x|+|y|最小解 扩展欧几里得

/* * url: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p...

(DS 《算法入门经典》)UVA 11991 Easy Problem from Rujia Liu?(求第k个v出现的索引)

题目大意:   求第k个v出现的索引解题思路:  如果能构造出一个数据结构,使得data[v][k]就是第k个v出现的索引值即可求解。data[v]表示数v出现的索引数组,data[v][k]表示第k...

uva 10025 - The ? 1 ? 2 ? ... ? n = k problem

The ? 1 ? 2 ? ... ? n = k problem  The problem Given the following formula, one ca...

UVa 10025 The ? 1 ? 2 ? ... ? n = k problem (数学&想法题&常数算法)

10025 - The ? 1 ? 2 ? ... ? n = k problem Time limit: 3.000 seconds http://uva.onlinejudge.org/index...

UVA 100 The 3n + 1 problem(超级大水题)

The 3n + 1 problem Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu ...

UVA_100: The 3n + 1 problem

Description Problems in Computer Science are often classified as belonging to a certain class of ...

UVa - The 3n + 1 problem 题解

本题和计算区间的质数有点相似的,思想上基本一致。 注意问题: 1 i 可能 大于等于j -- 载在这里了,要小心阅读题意,没说的地方就是不保证的,需要特殊处理 2 计算过程可能溢出,大于整数最大...

HDU1032&Uva100 The 3n + 1 problem

Problem Description Problems in Computer Science are often classified as belonging to a certain cla...

UVA100 The 3n + 1 problem

The 3n + 1 problem  Background Problems in Computer Science are often classified as be...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:UVa 893 Y3K Problem (用GregorianCalendar类秒杀)
举报原因:
原因补充:

(最多只允许输入30个字)