数据模板
数据模板(hdu2845)
//#include<bits/stdc++.h> //#include <ctime> //using namespace std; // //int main() { // FILE *fin; // fin=fopen("5.in","w"); // srand((unsigned) time(NULL)); // int T=1,n,m; // while(T--) { // n=1; // m=200000; // fprintf(fin,"%d %d\n",n,m); // for(int i=0; i<n; i++) { // for(int j=0; j<m-1; j++) { // fprintf(fin,"%d ",rand()%1001); // } // fprintf(fin,"%d\n",rand()%1001); // } // m=1; // n=200000; // fprintf(fin,"%d %d\n",n,m); // for(int i=0; i<n; i++) { // for(int j=0; j<m-1; j++) { // fprintf(fin,"%d ",rand()%1001); // } // fprintf(fin,"%d\n",rand()%1001); // } // } // return 0; //} #include<iostream> #include<stdio.h> #include<cstdio> using namespace std; #define maxn 222222 int x[maxn],y[maxn]; int main(){ int n,m,ox; FILE *fin,*fout; fin=fopen("5.in","r"); fout=fopen("55.out","w"); while(~fscanf(fin,"%d%d",&n,&m)){ for(int i=2;i<=n+1;++i){ for(int j=2;j<=m+1;++j){ fscanf(fin,"%d",&ox); x[j]=max(x[j-1],x[j-2]+ox); } y[i]=max(y[i-1],y[i-2]+x[m+1]); } fprintf(fout,"%d\n",y[n+1]); } return 0; }
#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cstdio>
using namespace std;
#define x 1e7
int RAND(int min,int max){
return (double)rand()/(RAND_MAX+1)*(max-min)+min;
}
int main(){
srand((unsigned)time(NULL));
int T=RAND(1000,1000);
freopen("1.in","w",stdout);
while(T--){
int n=RAND(1,100);
cout<<n<<endl;
for(int i=0;i<n;i++){
cout<<(char)('a'+RAND(1,26));
}
cout<<endl;
}
fclose(stdout);
return 0;
}