标签:style class blog c code java
#include<iostream> #include<algorithm> #include<numeric> using namespace std; const int N = 10; int helper(int* a,const int num1,const int num2) { int i=1; int j=1; for(int m = 0;m<N;m++) { int tempi = i*num1; int tempj = j*num2; if(tempi > tempj) {a[m] = tempj;j++;} else if(tempi<tempj) {a[m] = tempi;i++;} else{ a[m] = tempi;i++;j++; } } return 1; } int main() { int a[N];////必须制定大小,如果不去赋初值的话 helper(a,3,5); for(int i = 0;i< N;i++) {cout<<" "<<a[i];} }
题目和思路都很赞!!!
标签:style class blog c code java
原文地址:http://www.cnblogs.com/berkeleysong/p/3736539.html