对拍程序(windows)
a+b
zj.cpp
| 1 2 3 4 5 6 7 8 9 10 | #include<iostream> using namespace std; int main() {     int a,b;     cin>>a>>b;     cout<<a+b<<endl; //    system("pause");     return 0; } | 
duipai.cpp
| 1 2 3 4 5 6 7 8 9 10 11 | #include<iostream> using namespace std; int main() {     int a,b;     cin>>a>>b;     while(b--) a++;     cout<<a<<endl; //    system("pause");     return 0; } | 
随机数生成器data.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<iostream> #include<ctime> #include<cstdlib> using namespace std; int main() { srand(time(0)); int a,b; a=rand(); b=rand(); cout<<a<<' '<<b<<endl; //system("pause"); return 0; } | 
对拍程序a.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<iostream> #include<windows.h> using namespace std; int main() {     int t=100;     while(t--)     {         system("data > a+b.in");         system("zj < a+b.in > 1.out");         system("duipai < a+b.in > 2.out");         if(system("fc 1.out 2.out"))   break;     }     system("pause");     return 0; } | 
将exe保存在同一个文件夹,运行对拍程序即可
快速幂
baoli.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 | #include<iostream> using namespace std; int main() {     long long n,k,m,s=1;     cin>>n>>k>>m;     for(int i=1;i<=k;i++)         {s*=n;s%=m;}         cout<<s;         //system("pause");     return 0; } | 
zhengjie.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<iostream> using namespace std; int main() {     long long  n,k,m,s=1;     cin>>n>>k>>m;     while(k>0)     {               if(k%2==1)               {s*=n;s%=m;}               k/=2;               n=n*n%m;               }     cout<<s;     system("pause");     return 0; } | 
data.cpp
C++
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<iostream> #include<ctime> #include<cstdlib> using namespace std; int main() { srand(time(0)); int a,b,c; a=rand(); b=rand(); c=rand(); cout<<a<<' '<<b<<' '<<c<<endl; //system("pause"); return 0; } | 
对拍程序
a.cpp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<iostream> #include<windows.h> using namespace std; int main() {     int t=100;     while(t--)     {               system("data > mi.in");               system("zhengjie < mi.in > 1.out");               system("baoli < mi.in > 2.out");               if(system("fc 1.out 2.out"))break;               }     system("pause");     return 0; } | 
 
			
请问黄学长怎么用%random%对拍,这样1s才1次啊
求解..为什么每次运行都会弹出对应的三个cpp文件…