作业介绍
快点做
最后一题:
c++
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define pos(x,y) (x+(y)*n)
const int N=100000+10;
const int inf=0x3f3f3f3f;
const ll mod=1000000007;
const double eps=1e-8;
int n,m,k;
int tmp[101];
struct node {
int x[101];
node operator*(node a) {
node res;
FOR(i,n) res.x[i]=x[a.x[i]];
return res;
}
void operator=(node a) {
FOR(i,n) x[i]=a.x[i];
}
} a[11];
node s;
node b;
node qpow(node a,int b) {
node res=s;
while (b) {
if (b&1) res=res*a;
a=a*a;
b>>=1;
}
return res;
}
int main() {
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
cin>>n>>m>>k;
FOR(i,m) FOR(j,n) {
cin>>a[i].x[j];
}
int q=k/m,r=k%m;
FOR(i,n) s.x[i]=i;
b=a[1];
REP(i,2,m) b=b*a[i];
b=qpow(b,q);
s=s*b;
FOR(i,r) s=s*a[i];
FOR(i,n) cout<<s.x[i]<<" ";
cout<<endl;
return 0;
}
题目
题目 |
---|
#1: P1021 Kerry 的电缆网络 |
#2: P1022 观光旅游 |
#3: P1023 最小公倍数 |
#4: P1024 送给圣诞夜的贺卡 |
#5: P1025 送给圣诞夜的礼品 |
- 状态
- 已结束
- 题目
- 5
- 开始时间
- 2019-07-08 22:00
- 截止时间
- 2020-05-08 07:00
- 可延期
- 24.0 小时