WERTYU – UVA 10082

http://uva.onlinejudge.org/external/100/10082.html

import java.util.*;
public class p10082 {
    public static void main (String chayapoth[]){
        Scanner input = new Scanner(System.in);
        int c ;
        String s;
        while(input.hasNext()){
            s=input.nextLine();
            char [] ab = new char [s.length()] ;
            s.getChars (0, s.length(), ab, 0) ;

            c = 0;
            while(c < ab.length) {
                if( ab [c]=='A')
                    ab [c]='A';
                else if(ab [c]=='B')
                    ab [c]='V';
                else if(ab [c]=='C')
                    ab [c]='X';
                else if(ab [c]=='D')
                    ab [c]='S';
                else if(ab [c]=='E')
                    ab [c]='W';
                else if(ab [c]=='F')
                    ab [c]='D';
                else if(ab [c]=='G')
                    ab [c]='F';
                else if(ab [c]=='H')
                    ab [c]='G';
                else if(ab [c]=='I')
                    ab [c]='U';
                else if(ab [c]=='J')
                    ab [c]='H';
                else if(ab [c]=='K')
                    ab [c]='J';
                else if(ab [c]=='L')
                    ab [c]='K';
                else if(ab [c]=='M')
                    ab [c]='N';
                else if(ab [c]=='N')
                    ab [c]='B';
                else if(ab [c]=='O')
                    ab [c]='I';
                else if(ab [c]=='P')
                    ab [c]='O';
                else if(ab [c]=='Q')
                    ab [c]='Q';
                else if(ab [c]=='R')
                    ab [c]='E';
                else if(ab [c]=='S')
                    ab [c]='A';
                else if(ab [c]=='T')
                    ab [c]='R';
                else if(ab [c]=='U')
                    ab [c]='Y';
                else if(ab [c]=='V')
                    ab [c]='C';
                else if(ab [c]=='W')
                    ab [c]='Q';
                else if(ab [c]=='X')
                    ab [c]='Z';
                else if(ab [c]=='Y')
                    ab [c]='T';
                else if(ab [c]=='Z')
                    ab [c]='Z';
                else if(ab [c]=='[')
                    ab [c]='P';
                else if(ab [c]==']')
                    ab [c]='[';
                else if(ab [c]=='\\')
                    ab [c]=']';
                else if(ab [c]==';')
                    ab [c]='L';
                else if(ab [c]=='\'')
                    ab [c]=';';
                else if(ab [c]=='/')
                    ab [c]='.';
                else if(ab [c]=='.')
                    ab [c]=',';
                else if(ab [c]==',')
                    ab [c]='M';
                else if(ab [c]=='1')
                    ab [c]='`';
                else if(ab [c]=='2')
                    ab [c]='1';
                else if(ab [c]=='3')
                    ab [c]='2';
                else if(ab [c]=='4')
                    ab [c]='3';
                else if(ab [c]=='5')
                    ab [c]='4';
                else if(ab [c]=='6')
                    ab [c]='5';
                else if(ab [c]=='7')
                    ab [c]='6';
                else if(ab [c]=='8')
                    ab [c]='7';
                else if(ab [c]=='9')
                    ab [c]='8';
                else if(ab [c]=='0')
                    ab [c]='9';
                else if(ab [c]=='-')
                    ab [c]='0';
                else if(ab [c]=='=')
                    ab [c]='-';
                c++;
            }

            c=0;

            while(c < ab.length) {
                System.out.print(ab [c]);
                c++;
            }
            System.out.println("");
        }
    }
}

Advertisements

Odd Sum – UVA 10783

http://uva.onlinejudge.org/external/107/10783.html

import java.util.*;
public class p10783 {
    public static void main (String chayapoth[]){
        Scanner input = new Scanner(System.in);
        int testcase;
        testcase=input.nextInt();
        long a;
        long b;
        long oddsum = 0;
        long counter = 1;
        while(testcase > 0){
            a = input.nextInt();
            b = input.nextInt();

            while(a<=b){
                if(a % 2 != 0){
                    oddsum=oddsum+a;
                }
                a++;
            }

            System.out.println("Case"+" "+counter+":"+" "+oddsum);

            oddsum = 0;
            counter++;
            testcase--;
        }
    }
}

Relational Operators – UVA 11172

http://uva.onlinejudge.org/external/111/11172.html


import java.util.*;
public class p11172 {
    public static void main (String chayapoth[]){
        Scanner input = new Scanner(System.in);
        int testcase;
        testcase = input.nextInt();
        long a;
        long b;
        while(testcase>0) {

            a = input.nextInt();
            b = input.nextInt();

              if(a < b)
                  System.out.println("<");
              else if (a > b)
                  System.out.println(">");
              else if (a == b)
                  System.out.println("=");
 

            testcase--;
        }
    }
}

Pizza Cutting – UVA 10079

http://uva.onlinejudge.org/external/100/10079.html
import java.util.*;
public class kiholo {
    public static void main (String chayapoth[]){
        Scanner input = new Scanner(System.in);
        long sum=1;
        long incrementbyone=1;
        long ja;
        ja=input.nextLong();

        while(ja>=0){

            while(ja>0){ // when input zero then output one  bcause  then you will get the whole pizza !!!

                sum=sum+incrementbyone;
                incrementbyone++;
                ja--;
            }
            System.out.println(sum);
            ja=input.nextLong();
            sum=1;
            incrementbyone=1;
        }
    }
}

Back to High School Physics – UVA 10071

http://uva.onlinejudge.org/external/100/10071.html
import java.util.Scanner;
public class Main {

  public static void main (String args []) {

    Scanner input = new Scanner (System.in);

    while (input.hasNext()) {
      long v,t,s;
      v = input.nextLong();
      t = input.nextLong();
      s = 2*v*t;
      if (s < 0) {
        s = -s;
        System.out.println(s);
      } else  {
        System.out.println(s);
      }
    }
  }
}

Hashmat the brave warrior – UVA 10055

http://uva.onlinejudge.org/external/100/10055.html
import java.util.Scanner;
public class wish {

    public static void main (String args []) {

        Scanner input = new Scanner (System.in);

        while (input.hasNext()) {

            long a,b,c;
            a = input.nextLong();
            b = input.nextLong();

            if(b > a) {
                c = b - a;
                System.out.println(c);
            }

            else {
                c = a - b;
                System.out.println(c);
            }
        }
    }
}