原题链接

参考代码:

#include <iostream>
#include <cstring>
using namespace std; const int maxn = + , INF = 0x3f3f3f3f;
int value[maxn], ans[maxn];
bool vis[maxn], flag; int main() {
int n;
cin >> n;
flag = true;
memset(vis, false, sizeof vis);
for(int i = ; i < n - ; i ++) cin >> value[i];
ans[] = ;
int Min = INF;
for(int i = ; i < n - ; i ++) {
ans[i + ] = ans[i] + value[i];
}
for(int i = ; i < n; i ++)
Min = min(Min, ans[i]); for(int i = ; i < n; i ++) {
ans[i] += - Min;
if(ans[i] > && ans[i] < maxn)
vis[ans[i]] = true;
}
for(int i = ; i <= n; i ++)
if(!vis[i]) flag = false;
if(!flag) cout << -;
else {
for(int i = ; i < n; i ++) cout << ans[i] << ' ';
}
cout << endl;
return ;
}

<每日一题> Day2:CodeForces-1141C.PolycarpRestoresPermutation(思维题)的更多相关文章

  1. CodeForces - 631C ——(思维题)

    Each month Blake gets the report containing main economic indicators of the company "Blake Tech ...

  2. CodeForces - 1102A(思维题)

    https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You ha ...

  3. <每日一题> Day1:CodeForces.1140D.MinimumTriangulation(思维题)

    题目链接 参考代码: #include <iostream> using namespace std; int main() { ; int n; cin >> n; ; i ...

  4. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  5. Codeforces 1038D - Slime - [思维题][DP]

    题目链接:http://codeforces.com/problemset/problem/1038/D 题意: 给出 $n$ 个史莱姆,每个史莱姆有一个价值 $a[i]$,一个史莱姆可以吃掉相邻的史 ...

  6. CodeForces - 468A ——(思维题)

    Little X used to play a card game called "24 Game", but recently he has found it too easy. ...

  7. CodeForces - 669D——(思维题)

    Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced b ...

  8. CodeForces - 589D —(思维题)

    Welcoming autumn evening is the best for walking along the boulevard and npeople decided to do so. T ...

  9. Sonya and Robots CodeForces - 1004C (思维题)

    Sonya and Robots time limit per test 1 second memory limit per test 256 megabytes input: standard in ...

随机推荐

  1. Selenium Java tutorial

     https://eyes.applitools.com/app/test-results 1.

  2. 进程队列补充、socket实现服务器并发、线程完结

    目录 1.队列补充 2.关于python并发与并行的补充 3.TCP服务端实现并发 4.GIL全局解释器锁 什么是保证线程安全呢? GIL与Lock 5.验证多线程的作用 对结论的验证: 6.死锁现象 ...

  3. HTML5基础内容(二)

    HTML(HyperText Markup Language)超文本标记语言 一.HTML注释 元素就是标签,标签就是元素. 注释中的内容不会在页面中显示,但是可以在源码中看到. 可以通过编写注释来对 ...

  4. ExoPlayer + 边缓存边播放

    在此基础上改动:https://www.cnblogs.com/candyzhmm/p/9957928.html private void openPlayer(String videoUrl) { ...

  5. Java——package与import

    [package]   <1>为了解决类的命名冲突问题,Java引入包(package)机制,提供类的多重类命名空间. <2>package作为源文件的第一条语句(缺省时指定为 ...

  6. Oulipo【Hash】

    Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 45515   Accepted: 18181 Descript ...

  7. php日志托管给apache处理

    php.ini配置: log_errors = On;不显示错误display_startup_errors = Offdisplay_errors = Off ;除了notice级别错误外,报告所有 ...

  8. 特征提取算法(4)——LoG特征提取算法

    目录 1.介绍 2.LoG原理 3.数学原理 4.模板性质 1.介绍 LoG(DoG是一阶边缘提取)是二阶拉普拉斯-高斯边缘提取算法,先高斯滤波然后拉普拉斯边缘提取. Laplace算子对通过图像进行 ...

  9. IOC和AOP使用扩展之AOP详解实现类

    摘要:   “Depend on yourself” is what nature says to every man.  Parents can help you. Teachers can hel ...

  10. 从Java 调用JavaScript

    篇幅过长 下载资源链接https://www.slidestalk.com/s/java_javascript_5hl09w