﻿PAT(B) 1025. 反转链表 (25)-Ocrosoft

PAT(B) 1025. 反转链表 (25)

```00100 6 4
00000 4 99999
00100 1 12309
68237 6 -1
33218 3 00000
99999 5 68237
12309 2 33218
```

```00000 4 33218
33218 3 12309
12309 2 00100
00100 1 99999
99999 5 68237
68237 6 -1
```

```#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
#define strend string::npos
#define ms(a) memset(a,0,sizeof(a))
#define rep(a,v,b) for(int a=v;a<b;a++)
#define repe(a,v,b) for(int a=v;a<=b;a++)
#define pre(a,v,b) for(int a=v;a>b;a--)
#define pree(a,v,b) for(int a=v;a>=b;a--)
#define lowbit(x) x&-x
typedef long long LL;
const LL LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const int MAXN = 27 + 10;
const int MOD = 1000000007;
int gcd(int a, int b)
{
if (!b)return a;
return gcd(b, a%b);
}
/*(◕‿‿◕)(◕‿‿◕) (◕‿‿◕) (◕‿‿◕) (◕‿‿◕) (◕‿‿◕)*/
/*(◕‿‿◕) 签订契约,成为马猴烧酒吧 (◕‿‿◕)*/
/*(◕‿‿◕)(◕‿‿◕) (◕‿‿◕) (◕‿‿◕) (◕‿‿◕) (◕‿‿◕)*/
using namespace std;
struct node
{
int data;
int next;
};
int main()
{
vector<node> vin(100000);
vector<node> vsorted;
vector<node> vout;
node temp;
int first, N, K;

scanf("%d%d%d", &first, &N, &K);

for (int i = 0; i < N; i++)
{
}
if (first == -1)printf("-1\n");
else
{
{
}
int Nnew = vsorted.size();
int right = K - 1;
while (right < Nnew)
{
for (int i = right; i > right - K; i--)
vout.push_back(vsorted[i]);
right += K;
}
for (int i = right - K + 1; i < Nnew; i++)
vout.push_back(vsorted[i]);
for (int i = 0; i < Nnew - 1; i++)
{