B
1 //c++
2 #include <cstdio>
3 #include <cstdlib>
4 #include <cstring>
5 #include <iostream>
6 using namespace std;
7
8 string n;
9 int a[101];
10
11 int main()
12 {
13 while (cin>>n)
14 {
15 memset(a,0,sizeof(a));
16 a[0]=n.size();
17 for (int i=1;i<=a[0];i++)
18 a[i]=n[a[0]-i]-'0';
19 for (int j=1;j<=a[0];j++)
20 a[j]=a[j]*6;
21 for (int j=1;j<=a[0];j++)
22 {
23 a[j+1]+=a[j]/10;
24 a[j]=a[j]%10;
25 }
26 while (a[a[0]+1]>0)
27 {
28 a[0]++;
29 a[a[0]+1]+=a[a[0]]/10;
30 a[a[0]]%=10;
31 }
32 a[1]-=3;
33 int k=1;
34 while (a[k]<0 && k<=a[0])
35 {
36 a[k+1]-=1;
37 a[k]+=10;
38 k++;
39 }
40 while (a[a[0]]<=0)
41 a[0]--;
42 for (int i=a[0];i>0;i--)
43 printf("%d",a[i]);
44 printf("\n");
45 }
46 return 0;
47 }
48
49
50 // java
51 import java.io.*;
52 import java.math.BigInteger;
53 import java.util.*;
54
55 public class Main
56 {
57 public static void main(String args[])
58 {
59 Scanner cin = new Scanner(System.in);
60 while(cin.hasNext())
61 {
62 BigInteger a = cin.nextBigInteger();
63 BigInteger b=BigInteger.valueOf(2);
64 a=a.multiply(b);
65 b=BigInteger.valueOf(1);
66 a=a.subtract(b);
67 b=BigInteger.valueOf(3);
68 a=a.multiply(b);
69 System.out.println(a);
70 }
71 }
72 }
2 #include <cstdio>
3 #include <cstdlib>
4 #include <cstring>
5 #include <iostream>
6 using namespace std;
7
8 string n;
9 int a[101];
10
11 int main()
12 {
13 while (cin>>n)
14 {
15 memset(a,0,sizeof(a));
16 a[0]=n.size();
17 for (int i=1;i<=a[0];i++)
18 a[i]=n[a[0]-i]-'0';
19 for (int j=1;j<=a[0];j++)
20 a[j]=a[j]*6;
21 for (int j=1;j<=a[0];j++)
22 {
23 a[j+1]+=a[j]/10;
24 a[j]=a[j]%10;
25 }
26 while (a[a[0]+1]>0)
27 {
28 a[0]++;
29 a[a[0]+1]+=a[a[0]]/10;
30 a[a[0]]%=10;
31 }
32 a[1]-=3;
33 int k=1;
34 while (a[k]<0 && k<=a[0])
35 {
36 a[k+1]-=1;
37 a[k]+=10;
38 k++;
39 }
40 while (a[a[0]]<=0)
41 a[0]--;
42 for (int i=a[0];i>0;i--)
43 printf("%d",a[i]);
44 printf("\n");
45 }
46 return 0;
47 }
48
49
50 // java
51 import java.io.*;
52 import java.math.BigInteger;
53 import java.util.*;
54
55 public class Main
56 {
57 public static void main(String args[])
58 {
59 Scanner cin = new Scanner(System.in);
60 while(cin.hasNext())
61 {
62 BigInteger a = cin.nextBigInteger();
63 BigInteger b=BigInteger.valueOf(2);
64 a=a.multiply(b);
65 b=BigInteger.valueOf(1);
66 a=a.subtract(b);
67 b=BigInteger.valueOf(3);
68 a=a.multiply(b);
69 System.out.println(a);
70 }
71 }
72 }