Magic Stones(思维题)
Posted lightac
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Magic Stones(思维题)相关的知识,希望对你有一定的参考价值。
#include <bits/stdc++.h> using namespace std; typedef long long ll; int v1[100001]; int v2[100001]; int s1[100001]; int s2[100001]; int main () ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; ++i) cin >> v1[i]; for (int i = 0; i < n; ++i) cin >> s1[i]; if(v1[0] != s1[0] || v1[n - 1] != s1[n - 1]) cout << "No" << endl; return 0; for (int i = 1; i < n; ++i) v2[i - 1] = v1[i] - v1[i - 1]; s2[i - 1] = s1[i] - s1[i - 1]; sort(v2, v2 + n); sort(s2, s2 + n); for (int i = 0; i < n - 1; ++i) if (v2[i] != s2[i]) cout << "No" << endl; return 0; cout << "Yes" << endl;
以上是关于Magic Stones(思维题)的主要内容,如果未能解决你的问题,请参考以下文章