Chef and His Apartment Dues.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* package whatever; // don’t place package name!

https://www.codechef.com/FEB17/problems/CHEFAPAR

http://ideone.com/vqDWdM

*/

import java.util.*;
import java.lang.*;
import java.io.*;
class Solution
{
	public static void main (String[] args) throws java.lang.Exception
	{
// your code goes here
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int i = 0; i<t;i++){
			int total = 0,flag=0;
			int months = sc.nextInt();
			for(int j = 0 ; j<months;j++){ 
				int paid = sc.nextInt(); 
				if(paid == 0){ 
					total +=1000; flag ++; 
				}else{ 
					if(flag>0)
						total =total+(100*(flag+1));
					flag = 0;
				}

			}
			if(flag >0){
				total = total+(100*flag);
			}
			System.out.println(total);

		}
	}
}

Converting number into String.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Ketan D Ramteke
//Converting Digit to Sting

import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		char[] n = sc.next().toCharArray();
		String[] arr = {Zero,One,Two,Three,Four,Five,Six,Seven,
			Eight,Nine};
			String numberString = “”;
			for(int i = 0; i<n.length;i++){
				numberString +=arr[Integer.parseInt((String.valueOf(n[i])))]+ ;
			}
			System.out.println(numberString);

		}
	}