-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURI_1257.java
More file actions
31 lines (28 loc) · 787 Bytes
/
URI_1257.java
File metadata and controls
31 lines (28 loc) · 787 Bytes
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
import java.util.*;
public class URI_1257
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int n = sc.nextInt();
sc.nextLine();//TO ignore the input buffer
int sum = 0;
for(int i=0; i<n; i++)
{
String str = sc.nextLine();
int j = 0;
while(str.length() > j)
{
//sum = sum + valueOfCharacters+i+position
sum = sum + ( (int)str.charAt(j) - 65 ) + i + j;
j++;
}
}
System.out.println(sum);
}
return;
}
}