Skip to content

Commit 6a37682

Browse files
committed
update template
1 parent c7b2e15 commit 6a37682

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

A.java

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import java.io.*;
44
import java.math.*;
55

6-
/*
6+
/**
77
* Author : joney_000[[email protected]]
8-
* Algorithm : N/A
8+
* Algorithm : Extended Euclid Algo: find 3 things X, Y, GCD(A, B) Such that X * A + Y * B = GCD(A, B)
9+
* Time : O(MAX(A, B)) Space : O(MAX(A, B))
910
* Platform : Codeforces
10-
* Ref :
11+
* Ref : https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/tutorial/
1112
*/
1213

13-
class A{
14+
public class A{
1415

1516
private InputStream inputStream ;
1617
private OutputStream outputStream ;
@@ -19,10 +20,6 @@ class A{
1920

2021
private final int BUFFER = 100005;
2122

22-
private int auxInts[] = new int[BUFFER];
23-
private long auxLongs[] = new long[1];
24-
private double auxDoubles[] = new double[1];
25-
private char auxChars[] = new char[1];
2623
private final long mod = 1000000000+7;
2724
private final int INF = Integer.MAX_VALUE;
2825
private final long INF_L = Long.MAX_VALUE / 10;
@@ -40,14 +37,11 @@ public A(boolean stdIO)throws FileNotFoundException{
4037
in = new FastReader(inputStream);
4138
out = new PrintWriter(outputStream);
4239
}
43-
40+
4441
void run()throws Exception{
4542
int n = i();
46-
47-
int ans = 0;
48-
43+
long ans = 0;
4944
out.write(""+ans+"\n");
50-
5145
}
5246

5347
void clear(){
@@ -77,10 +71,10 @@ long pow(long a, long b, long mod){
7771
if(b == 0)return 1;
7872
if(b == 1)return a;
7973
long ans = pow(a, b/2, mod);
80-
ans = (ans * ans);
74+
ans = mulMod(ans, ans, mod);
8175
if(ans >= mod)ans %= mod;
8276

83-
if(b % 2 == 1)ans = (a * ans);
77+
if(b % 2 == 1)ans = mulMod(a, ans, mod);
8478
if(ans >= mod)ans %= mod;
8579

8680
return ans;
@@ -107,46 +101,26 @@ int i()throws Exception{
107101
return in.nextInt();
108102
}
109103

110-
int[] is(int n)throws Exception{
111-
for(int i=1 ; i <= n ;i++)auxInts[i] = in.nextInt();
112-
return auxInts;
113-
}
114-
115104
long l()throws Exception{
116105
return in.nextLong();
117106
}
118107

119-
long[] ls(int n)throws Exception{
120-
for(int i=1 ; i <= n ;i++)auxLongs[i] = in.nextLong();
121-
return auxLongs;
122-
}
123-
124108
double d()throws Exception{
125109
return in.nextDouble();
126110
}
127111

128-
double[] ds(int n)throws Exception{
129-
for(int i=1 ; i <= n ;i++)auxDoubles[i] = in.nextDouble();
130-
return auxDoubles;
131-
}
132-
133112
char c()throws Exception{
134113
return in.nextCharacter();
135114
}
136115

137-
char[] cs(int n)throws Exception{
138-
for(int i=1 ; i <= n ;i++)auxChars[i] = in.nextCharacter();
139-
return auxChars;
140-
}
141-
142116
String s()throws Exception{
143117
return in.nextLine();
144118
}
145119

146120
BigInteger bi()throws Exception{
147121
return in.nextBigInteger();
148122
}
149-
123+
150124
private void closeResources(){
151125
out.flush();
152126
out.close();

0 commit comments

Comments
 (0)