高精度求模(同餘定理)

#include <bits/stdc++.h>
using namespace std;
const int mod = 1e2;
int high(string s,const int &mod){
	int ans = 0;
	for(int i=0;i<s.length();i++){
		ans = (ans*10+s[i]-'0')%mod;
	}
	return ans;
}
int main(){
	string s;
	cin>>s; 
	cout<<high(s,mod)<<endl;
	return 0;
} 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章