POJ 3751 JAVA】的更多相关文章

题意: 对于给定的采用”yyyy/mm/dd”加24小时制(用短横线”-”连接)来表示日期和时间的字符串, 请编程实现将其转换成”mm/dd/yyyy”加12小时制格式的字符串,末尾加上pm或者am. 思路: 使用java的date与SimpleDateFormat, 注意HH是24小时制,而hh是12小时制, 如果加pm,am,需要添加参数a和Locale.ENGLISH 如:SimpleDateFormat("MM/dd/yyyy-hh:mm:ssa",Locale.ENGLISH…
题目链接:http://poj.org/problem?id=3751 题目大意:按照要求的格式将输入的时间日期进行转化. #include <iostream> #include <cstdio> using namespace std; int main () { int t; cin>>t; while (t--) { int y,m,d,xs,fz,ms; char ch1,ch2,ch3,ch4,ch5; //scanf("%d/%d/%d-%d:%…
import java.io.* ; import java.math.* ; import java.util.* ; import java.text.* ; public class Main { public static void main(String[] args) { Scanner cin=new Scanner (System.in) ; BigDecimal A; int B ; while(cin.hasNext()){ A=cin.nextBigDecimal() ;…
POJ 3468 (Java,c++实现) Java import java.io.*; import java.util.*; public class Main { static int n, m; static final int N = 100005; static int ls[] = new int[N << 2]; static int rs[] = new int[N << 2]; static long M[] = new long[N << 2];…
这里指的java速成,只限于java语法,包括输入输出,运算处理,字符串和高精度的处理,进制之间的转换等,能解决OJ上的一些高精度题目. 1. 输入: 格式为:Scanner cin = new Scanner (new BufferedInputStream(System.in)); 例程: import java.io.*; import java.math.*; import java.util.*; import java.text.*; public class Main { publ…
Bridge over a rough river Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4143   Accepted: 1703 Description A group of N travelers (1 ≤ N ≤ 50) has approached an old and shabby bridge and wishes to cross the river as soon as possible. Ho…
Candies POJ-3159 这里是图论的一个应用,也就是差分约束.通过差分约束变换出一个图,再使用Dijikstra算法的链表优化形式而不是vector形式(否则超时). #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<vector> #include<queue>…
Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover the entire input string (not partial). The function p…
Question: Given a sorted array of n integers that has been rotated an unknown number of times, write code to find an element in the array. You may assume that the array was originally sorted in increasing order. package POJ; import java.util.Arrays;…
Question: Write a method to sort an array of strings so that all the anagrams are next to each other. package POJ; import java.util.Arrays; import java.util.Comparator; import java.util.Hashtable; import java.util.LinkedList; import java.util.List; p…