Skip to content

Commit e75c061

Browse files
committed
Create 1633A-Div7.cpp
1 parent 9e318eb commit e75c061

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

1633A-Div7.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
3+
int main(){
4+
5+
6+
long t; std::cin >> t;
7+
while(t--){
8+
std::string s; std::cin >> s;
9+
long n = s.size();
10+
long mod(0);
11+
for(long p = 0; p < n; p++){mod = 10 * mod + (s[p] - '0'); mod %= 7;}
12+
s[n - 1] = (s[n - 1] >= (mod + '0')) ? (s[n - 1] - mod) : (s[n - 1] + 7 - mod);
13+
std::cout << s << std::endl;
14+
}
15+
16+
}

0 commit comments

Comments
 (0)