Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. //Java
  2. import java.util.*;
  3.  
  4. class uva10093{
  5. public static void main(String args[]){
  6. Scanner sc=new Scanner(System.in);
  7. String st;
  8.  
  9. while(sc.hasNextLine()){
  10. st=sc.nextLine();
  11.  
  12. char Ctemp[]=st.toCharArray();
  13. int sum=0;
  14. int max=1;
  15. for(char temp:Ctemp){
  16. int R=0;
  17. if(temp>=48 && temp<=57){
  18. R=temp-48;
  19. }else if(temp>=65 && temp<=90){
  20. R=temp-55;
  21. }else if(temp>=97 && temp<=122){
  22. R=temp-61;
  23. }
  24. sum=sum+R;
  25. if(R>max) max=R;
  26. }
  27.  
  28. for(int i=max;i<=62;i++){
  29. if(i==62){
  30. System.out.println("such number is impossible!");
  31. break;
  32. }
  33. if(sum%i==0){
  34. System.out.println(i+1);
  35. break;
  36. }
  37.  
  38. }
  39. }
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement