// Topcoder SRM 572 DIV 2 1 EasyHomework
import java.util.*;
import java.math.*;
public class EasyHomework {
public static void main(String[] args) {
System.out.println(
//
new EasyHomework().determineSign(
null
));
}
public String determineSign(int[] A) {
int neg = 0;
for (int i = 0; i < A.length; i++) {
if (A[i] == 0)
return "ZERO";
else if (A[i] < 0)
neg++;
}
if (neg % 2 == 0)
return "POSITIVE";
return "NEGATIVE";
}
}
Some solution examples of problems in topcoder, codeeval, google code jam, interviewstreet, onlinejudge-uva, codeforces, projecteuler, etc
Saturday, March 16, 2013
Codeforces Round #172 (Div. 2) A Word Capitalization
// Codeforces Round #172 (Div. 2) A Word Capitalization
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
//Codeforces
public class MainCodeforces1 {
private static MyScanner in;
private static PrintStream out;
public static void main(String[] args) throws IOException {
// helpers for input/output
boolean LOCAL_TEST = false;// change to false before submitting
out = System.out;
if (LOCAL_TEST) {
in = new MyScanner("E:\\zin2.txt");
}
else {
boolean usingFileForIO = false;
if (usingFileForIO) {
// using input.txt and output.txt as I/O
in = new MyScanner("input.txt");
out = new PrintStream("output.txt");
}
else {
in = new MyScanner();
out = System.out;
}
}
solve();
}
private static void solve() throws IOException
{
String s = in.nextString();
String ss = s.substring(0, 1).toUpperCase() + s.substring(1);
out.println(ss);
}
// =====================================
static class MyScanner {
Scanner inp = null;
public MyScanner() throws IOException
{
inp = new Scanner(System.in);
}
public MyScanner(String inputFile) throws IOException {
inp = new Scanner(new FileInputStream(inputFile));
}
public int nextInt() throws IOException {
return inp.nextInt();
}
public long nextLong() throws IOException {
return inp.nextLong();
}
public double nextDouble() throws IOException {
return inp.nextDouble();
}
public String nextString() throws IOException {
return inp.next();
}
}
}
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
//Codeforces
public class MainCodeforces1 {
private static MyScanner in;
private static PrintStream out;
public static void main(String[] args) throws IOException {
// helpers for input/output
boolean LOCAL_TEST = false;// change to false before submitting
out = System.out;
if (LOCAL_TEST) {
in = new MyScanner("E:\\zin2.txt");
}
else {
boolean usingFileForIO = false;
if (usingFileForIO) {
// using input.txt and output.txt as I/O
in = new MyScanner("input.txt");
out = new PrintStream("output.txt");
}
else {
in = new MyScanner();
out = System.out;
}
}
solve();
}
private static void solve() throws IOException
{
String s = in.nextString();
String ss = s.substring(0, 1).toUpperCase() + s.substring(1);
out.println(ss);
}
// =====================================
static class MyScanner {
Scanner inp = null;
public MyScanner() throws IOException
{
inp = new Scanner(System.in);
}
public MyScanner(String inputFile) throws IOException {
inp = new Scanner(new FileInputStream(inputFile));
}
public int nextInt() throws IOException {
return inp.nextInt();
}
public long nextLong() throws IOException {
return inp.nextLong();
}
public double nextDouble() throws IOException {
return inp.nextDouble();
}
public String nextString() throws IOException {
return inp.next();
}
}
}
Topcoder SRM 571 DIV 2 2 FoxAndMp3Easy
// Topcoder SRM 571 DIV 2 2 FoxAndMp3Easy
import java.util.*;
import java.math.*;
public class FoxAndMp3Easy {
public static void main(String[] args) {
System.out.println(
//
new FoxAndMp3Easy().playList(
5
));
}
public String[] playList(int n) {
ArrayList<String> s = new ArrayList<String>();
for (int i = 1; i <= n; i++) {
s.add(String.valueOf(i) + ".mp3");
}
Collections.sort(s);
String[] ss = new String[Math.min(n, 50)];
for (int i = 0; i < ss.length; i++) {
ss[i] = s.get(i);
}
return ss;
}
}
import java.util.*;
import java.math.*;
public class FoxAndMp3Easy {
public static void main(String[] args) {
System.out.println(
//
new FoxAndMp3Easy().playList(
5
));
}
public String[] playList(int n) {
ArrayList<String> s = new ArrayList<String>();
for (int i = 1; i <= n; i++) {
s.add(String.valueOf(i) + ".mp3");
}
Collections.sort(s);
String[] ss = new String[Math.min(n, 50)];
for (int i = 0; i < ss.length; i++) {
ss[i] = s.get(i);
}
return ss;
}
}
Subscribe to:
Posts (Atom)