HZAU 1006 The Nearest Same Chocolate
来源:互联网 发布:剑网3天策数据 编辑:程序博客网 时间:2024/05/01 19:32
原题
签到题
和2015年上海区域赛一题貌似一样的 有空找来看看
#include <climits>#include <cmath>#include <cstdio>#include <cstring>#include <iostream>using namespace std;const int MAX_N = 100 + 9;void solve(){ int a[MAX_N]; memset(a, 0, sizeof(a)); int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int ans = INT_MAX; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (a[j] == a[i] && j - i < ans) ans = j - i; } } printf("%d\n", ans);}int main(){// freopen("input.txt", "r", stdin); int t; scanf("%d", &t); for (int i = 0; i < t; i++) { solve(); }}
0 0
- HZAU 1006 The Nearest Same Chocolate
- The Nearest Same Chocolate
- Problem F: The Nearest Same Chocolate
- HZAU 1012 The Same Color
- HZAU 1007 Find The Difference
- Reginal2011_Chengdu_B Break the Chocolate
- hdu4112: Break the Chocolate
- Break the Chocolate HDU
- The nearest taller cow
- HDU 4112 Break the Chocolate
- hdu-4112-Break the Chocolate
- hdu 4112 Break the Chocolate
- HDU - 4112 Break the Chocolate
- HDU - 4112 Break the Chocolate
- just the same和all the same
- duplicate the same db
- The same feeling
- Under The Same Sky
- Poj 1741 Tree
- 倒排句子的单词
- 不惑JAVA之JAVA基础 - NIO (二)
- Qt5 QSqlDataBase很好的错误说明 关于连接
- android一些问题解决
- HZAU 1006 The Nearest Same Chocolate
- 关于GDCPC2016的反省
- tengine 淘宝 nginx
- 表单新增元素与属性
- Json解析详细教程
- Time类中的运算符重载
- android SeekBar设置背景无法被填充满的bug
- 【排序】基数排序
- GSM蜂窝基站定位基本原理浅析