Skip to content

Commit 53398d4

Browse files
authored
Remove redundant -0 (kyuridenamida#210)
1 parent 5e10d6a commit 53398d4

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

atcodertools/fmtprediction/models/calculator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def simplify(self):
149149
next_formula = re.sub(r"-1\+1$", "", current_formula)
150150
next_formula = re.sub(r"\+0$", "", next_formula)
151151
next_formula = re.sub(r"-0$", "", next_formula)
152+
next_formula = re.sub(r"[+-]0\+", "+", next_formula)
152153
if next_formula == current_formula:
153154
break
154155
current_formula = next_formula

tests/resources/test_codegen/test_two_dimensional_case/cpp/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ int main(){
1010
scanf("%lld",&H);
1111
long long W;
1212
scanf("%lld",&W);
13-
std::vector<std::vector<long long>> c(9-0+1, std::vector<long long>(9-0+1));
14-
for(int i = 0 ; i < 9-0+1 ; i++){
15-
for(int j = 0 ; j < 9-0+1 ; j++){
13+
std::vector<std::vector<long long>> c(9+1, std::vector<long long>(9+1));
14+
for(int i = 0 ; i < 9+1 ; i++){
15+
for(int j = 0 ; j < 9+1 ; j++){
1616
scanf("%lld",&c[i][j]);
1717
}
1818
}

tests/resources/test_codegen/test_two_dimensional_case/cs/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public class Program{
1313
H = cin.ReadLong;
1414
long W;
1515
W = cin.ReadLong;
16-
long[,] c = new long[9-0+1,9-0+1];
17-
for(int i = 0;i < 9-0+1;i++){
18-
for(int j = 0;j < 9-0+1;j++){
16+
long[,] c = new long[9+1,9+1];
17+
for(int i = 0;i < 9+1;i++){
18+
for(int j = 0;j < 9+1;j++){
1919
c[i,j] = cin.ReadLong;
2020
}
2121
}

tests/resources/test_codegen/test_two_dimensional_case/d/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ int main(){
1818
W = input.front.to!long;
1919
input.popFront;
2020

21-
long[][] c = new long[][](cast(size_t) (9-0+1), cast(size_t) (9-0+1));
22-
foreach (i; 0 .. cast(size_t) (9-0+1)) {
23-
foreach (j; 0 .. cast(size_t) (9-0+1)) {
21+
long[][] c = new long[][](cast(size_t) (9+1), cast(size_t) (9+1));
22+
foreach (i; 0 .. cast(size_t) (9+1)) {
23+
foreach (j; 0 .. cast(size_t) (9+1)) {
2424
c[i][j] = input.front.to!long;
2525
input.popFront;
2626
}

tests/resources/test_codegen/test_two_dimensional_case/java/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class Main {
88
H = sc.nextLong();
99
long W;
1010
W = sc.nextLong();
11-
long[][] c = new long[(int)(9-0+1)][(int)(9-0+1)];
12-
for(int i = 0 ; i < 9-0+1 ; i++){
13-
for(int j = 0 ; j < 9-0+1 ; j++){
11+
long[][] c = new long[(int)(9+1)][(int)(9+1)];
12+
for(int i = 0 ; i < 9+1 ; i++){
13+
for(int j = 0 ; j < 9+1 ; j++){
1414
c[i][j] = sc.nextLong();
1515
}
1616
}

tests/resources/test_codegen/test_two_dimensional_case/nim/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ proc main():void =
2222
H = nextInt()
2323
var W = 0
2424
W = nextInt()
25-
var c = newSeqWith(9-0+1, newSeqWith(9-0+1, 0))
26-
for i in 0..<9-0+1:
27-
for j in 0..<9-0+1:
25+
var c = newSeqWith(9+1, newSeqWith(9+1, 0))
26+
for i in 0..<9+1:
27+
for j in 0..<9+1:
2828
c[i][j] = nextInt()
2929
var A = newSeqWith(H, newSeqWith(W, 0))
3030
for i in 0..<H:

tests/resources/test_codegen/test_two_dimensional_case/python/generated_code.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def main():
1414
tokens = iterate_tokens()
1515
H = int(next(tokens)) # type: int
1616
W = int(next(tokens)) # type: int
17-
c = [[int(next(tokens)) for _ in range(9 - 0 + 1)] for _ in range(9 - 0 + 1)] # type: "List[List[int]]"
17+
c = [[int(next(tokens)) for _ in range(9 + 1)] for _ in range(9 + 1)] # type: "List[List[int]]"
1818
A = [[int(next(tokens)) for _ in range(W)] for _ in range(H)] # type: "List[List[int]]"
1919
solve(H, W, c, A)
2020

tests/resources/test_codegen/test_two_dimensional_case/rust/generated_code.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ fn main() {
1111
H = scanner.next();
1212
let mut W: i64;
1313
W = scanner.next();
14-
let mut c: Vec<Vec<i64>> = vec![vec![0i64; (9-0+1) as usize]; (9-0+1) as usize];
15-
for i in 0..(9-0+1) as usize {
16-
for j in 0..(9-0+1) as usize {
14+
let mut c: Vec<Vec<i64>> = vec![vec![0i64; (9+1) as usize]; (9+1) as usize];
15+
for i in 0..(9+1) as usize {
16+
for j in 0..(9+1) as usize {
1717
c[i][j] = scanner.next();
1818
}
1919
}

0 commit comments

Comments
 (0)