hiho week 88 register

Ended

Participants:577

Verdict:Accepted
Score:100 / 100
Submitted:2016-03-06 19:21:17

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cmath>
using namespace std;
int a[10001],b[10001];
int n,p,q,lena,lenb;
int main(){
    cin >> p >> q;
    for(int i = 1;i <= p;++i){
        if(p%i == 0)a[++lena] = i;
    }
    for(int i = 1;i <= q;++i){
        if(q%i == 0)b[++lenb] = i;
    }
    for(int i = 1;i <= lena;++i)
    for(int j = 1;j <= lenb;++j){
        cout << a[i] << " " << b[j] << endl;
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX