uva1593
来源:互联网 发布:javascript自学教程 编辑:程序博客网 时间:2024/06/09 17:43
第五章都是练习c++的,看了点书 ,教学视频,虽然懂了一点,但还是不行。自己写老是提交不对。目前就是看题解学c++。
今天终于找到了一个超级水题。不过,还是调了一会儿。因为vector<int>a;不能直接输入。。。
#include<cstdio>
#include<iostream>#include<vector>
using namespace std;
const int maxn = 15 + 5;
int main()
{
int N,n,mark = 0;
int a[maxn];
cin >> N;
for(int count = 0; count < N; ++count)
{
cin >> n;
for(int i = 0; i < n; ++i)cin >> a[i];
for(int i = 0;i != 1000; ++i)
{
int start = a[0];
for(int j = 0; j < n; ++j)
{
if(j!=n-1)
{
a[j] = a[j] - a[j+1];
if(a[j] < 0)a[j] = -a[j];
}
else
{
a[j] = a[j] - start;
if(a[j] < 0)a[j] = -a[j];
}
}
for(int j = 0;j < n; j++)
{
if(a[j]!=0)break;
if(j==n-1)mark = 1;
}
if(mark==1)break;
}
if(mark==1){mark = 0; cout << "ZERO" <<endl;}
else cout << "LOOP" << endl;
}
return 0;
}
0 0
- uva1593
- UVA1593
- UVa1593
- UVa1593
- Uva1593
- UVA1593 - Alignment of Code
- UVa1593 - Alignment of Code
- UVa1593 字符串处理
- 代码对齐UVa1593
- Uva1593 Alignment of Code
- Uva1593 代码对齐
- UVa1593 Alignment of Code
- uva1593代码对齐
- 5-1 代码对齐 UVA1593
- Uva1593——Alignment of Code
- UVA1593 Alignment of Code 数据结构
- Alignment of Code (代码对齐)UVA1593
- Uva1593 - Alignment of Code(getline、istringstream用法)
- ORACLE CASE WHEN 及 SELECT CASE WHEN的用法
- iOS开发UI基础—简单介绍静态单元格的使用
- linux例行性工作
- Android Spannable的使用
- Repeater在ItemDataBound事件中取出前行的内容
- uva1593
- 某电商网站Java面试题-2(高级开发,架构级别)
- Maven入门:安装使用以及基本操作
- 实用的19条android平台设计规范
- Android button按钮带圆角点击效果的样式
- oracle 自循环
- 跟着学!教你开发第一个Java程序
- Supporting Different Devices - Supporting Different Platform Versions
- HashSet和HashMap的区别