package Karl.Water;
/*
LANG: JAVA
TASK: beads
*/
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.LinkedList;
public class beads {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
BufferedReader br = new BufferedReader(new FileReader("beads.in"));
PrintWriter pw = new PrintWriter (new FileWriter("beads.out"));
int length = Integer.parseInt(br.readLine());
String temp = br.readLine();
LinkedList necklace = new LinkedList();
for (int i=0;i=max){
max = result;
}
}
pw.println(max);
pw.close();
br.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static int find(LinkedList necklace,int startPoint ,int endPoint,int direction){
if (direction ==0 ){
int i=startPoint+1;
for (;i<=endPoint-1;i++){
if (necklace.get(i)!=necklace.get(startPoint)&&necklace.get(i)!='w'){
break;
}
}
return i-1;
} else {
int i=startPoint-1;
for (;i>=endPoint+1;i--){
if (necklace.get(i)!=necklace.get(startPoint)&&necklace.get(i)!='w'){
break;
}
}
return i+1;
}
}
}
(2)
package Karl.Water;
/*
LANG: JAVA
TASK: friday
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class friday {
public static void main(String[] args) throws IOException {
int mon=0;
int tue=0;
int win=0;
int thur=0;
int fri=0;
int sat=0;
int sun=0;
int j=0;
int [][]days = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
BufferedReader br = new BufferedReader(new FileReader("friday.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("friday.out")));
int N = Integer.parseInt(br.readLine());
int flag;
for(int year = 1900;year<=1900+N-1;year++){
flag =(year%4==0 && year%100!=0) || year%400 == 0 ? 1 : 0;
for(int k=0;k<12;k++){
for(int i=0;i
package Karl.Water;
/*
LANG: JAVA
TASK: gift1
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class gift1 {
public static void main(String[] args) throws NumberFormatException, IOException {
HashMap hash = new HashMap();
StringTokenizer str;
BufferedReader br = new BufferedReader(new FileReader("gift1.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("gift1.out")));
int memnum = Integer.parseInt(br.readLine());
String[] s = new String[memnum];
for(int i=0;i
package Karl.Water;
/*
LANG: JAVA
TASK: milk2
*/
import java.util.*;
import java.io.*;
public class milk2 {
boolean time[]=new boolean[1000007];
int n,a,b,max_use,max_rex,tmp1,tmp2,start=10000007,stop=0;
public static void main(String[] args) throws IOException
{
new milk2().run();
}
void run() throws IOException
{
Scanner cin=new Scanner(new FileReader("milk2.in"));
PrintWriter cout=new PrintWriter(new BufferedWriter(new FileWriter("milk2.out")));
n=cin.nextInt();
for(int i=1;i<=n;i++)
{
a=cin.nextInt();
b=cin.nextInt();
start=startb ? stop:b;
for(int j=a;jtmp1 ? max_use:tmp1;
tmp1=0;
}
if(!time[i])
{
tmp2++;
}
else
{
max_rex=max_rex>tmp2 ? max_rex:tmp2;
tmp2=0;
}
}
// System.out.println(max_use+" "+max_rex);
cout.println(max_use+" "+max_rex);
cout.close();
System.exit(0);
}
}
这个程序有点问题,到第六七组数据时就出错了,
某君如果知道怎么写留个言也行。
package Karl.Water;
/*
LANG: JAVA
TASK: transform
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class transform {
public static void Reflection(char[][] a,int n){
char k;
int i,j;
for(j=0;j