</mce:script><mce:script type="text/javascript" src="http://hi.images.csdn.net/js/blog/tiny_mce/plugins/syntaxhl/langs/zh.js" mce_src="http://hi.images.csdn.net/js/blog/tiny_mce/plugins/syntaxhl/langs/zh.js"></mce:script>"cpp">//简单的高精度摸除,模除过程从个位开始,算当前位有 //个指针指向下一位 #include<iostream> #include<string> #include<vector> using namespace std; //模除函数 int high_mod(string a,int b) { string result; int temp = a[0] - '0'; int s = 1; go_on: while(temp<b&&s<a.size()) { temp = temp*10 + a[s++] - '0'; if(temp<b&&s<a.size()) result += '0'; } result += temp/b + '0'; temp = temp%b; if(s <a.size()) goto go_on; else return temp; } int main() { int n; cin>>n; while(n--) { int i; cin>>i;int b;string x;vector<int> bn; vector<int>::iterator p,q; while(i--) { cin>>b; bn.push_back(b); } cin>>x; p=bn.begin(); cout<<"("; while(p!=bn.end()) { q=p; q++; if(q!=bn.end()) cout<<high_mod(x,*p)<<','; else cout<<high_mod(x,*p)<<')'<<endl; p++; } } return 0; }