内网比赛,重开链接http://acm.hust.edu.cn/vjudge/contest/view.action?cid=36366#overview
题解链接,点击标题
素数基础运用(数论中最为重要的组成部分)
米勒拉宾素数测试的经典运用,目的:养成良好的习惯,积累经典模板
Primary Arithmetic
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; const int maxn = 105; int num1[ maxn ], num2[ maxn ], num[ maxn ]; int main(){ unsigned long long m, n; while( scanf( "%lld %lld", &m, &n ) != EOF ){ if( !m && !n ) break; memset( num1, 0, sizeof( num1 ) ); memset( num2, 0, sizeof( num2 ) ); int ans = 0, k1 = 0, k2 = 0; while( m ){ num1[ k1++ ] = m % 10; m /= 10; } // cout << k1 << endl; while( n ){ num2[ k2++ ] = n % 10; n /= 10; } // cout << k2 << endl; int len = max( k1, k2 ); int temp = 0; // cout << k1 << k2 << len << endl; for( int i = 0; i < len; ++i ){ temp = num1[ i ] + num2[ i ] + temp; if( temp > 9) ans++; temp /= 10; } if( !ans ) cout << "No carry operation." << endl; else if( ans == 1 ) cout << ans << " carry operation." << endl; else cout << ans << " carry operations." << endl; //return 0; } return 0; }
细节问题;
中国剩余定理
同余定理
扩展欧几里得
欧拉函数
chj解题报告http://blog.csdn.net/chj_zmr/article/details/15088107