mirror of
https://github.com/Hizenberg469/Algorithms-snippets.git
synced 2026-10-31 02:33:38 +02:00
String%n for string with more than 20 digit
This commit is contained in:
1 parent
00179c582d
commit
06b369f549
1 file changed
+11
@@ -0,0 +1,11 @@
|
||||
int operator%(string& a , int b){
|
||||
|
||||
int sz = (int)a.size();
|
||||
int val = 0;
|
||||
for(int idx = 0 ; idx < sz ; idx++ ){
|
||||
val = 10*val + (a[idx]-'0');
|
||||
val %= b;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
Reference in new issue
Block a user