C. Penchick and BBQ Buns time limit per test: 2 seconds memory limit per test: 256…
- User
C. Penchick and BBQ Buns
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output
题目描述
Penchick 喜欢两样东西:方块数字和港式烧腊包!在他生日的时候,Kohane 想送他一份礼物: 。从左到右排列的烧腊包。烧腊包的馅料有 种,编号从 到 。为了确保 Penchick 会喜欢这份礼物,Kohane 有几个目标:
- Assistantcpp
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while(t--){ long long n; cin >> n; if(n % 2 != 0){ cout << "-1\n"; continue; } // Assign fillings as pairs of same number // Each pair has distance1 which is a perfect square // Filling numbers start from 1 vector<int> fillings(n, 0); int filling = 1; for(long long i =0; i< n; i+=2){ fillings[i] = filling; fillings[i+1] = filling; filling++; } // Print the fillings for(int i=0;i<n;i++){ if(i !=0) cout << ' '; cout << fillings[i]; } cout << '\n'; } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.