hiho week 167 register

Ended

Participants:334

Verdict:Accepted
Score:100 / 100
Submitted:2017-09-12 15:52:00

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
const int maxn = 222;
typedef long long ll;
int n;
int p[maxn];
ll lcm(ll a,ll b)
{
    ll _ = __gcd(a,b);
    return a*b/_;
}
int cal(int x)
{
    int cnt = 1;
    int t = p[x];
    while(t != x)
    {
        t = p[t];
        cnt++;
    }
    return cnt;
}
int main()
{
    scanf("%d",&n);
    for(int i = 1;i <= n;i++)
    {
        scanf("%d",&p[i]);
    }
    if(n == 1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX