codeforces 701A A. Cards(水题)
题目链接:
题意:
问两个数的和相同,怎么组合;
AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>
#include <stack> using namespace std; #define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss)); typedef long long LL; template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {
if(!p) { puts("0"); return; }
while(p) stk[++ tp] = p%10, p/=10;
while(tp) putchar(stk[tp--] + '0');
putchar('\n');
} const LL mod=1e9+7;
const double PI=acos(-1.0);
const int inf=1e9;
const int N=1e5+10;
const int maxn=500+10;
const double eps=1e-6; int n,a[200],vis[200]; int main()
{
int n;
read(n);
int sum=0;
For(i,1,n)read(a[i]),sum+=a[i];
int le=2*sum/n;
For(i,1,n)
{
if(vis[i])continue;
For(j,1,n)
{
if(!vis[j]&&a[i]+a[j]==le&&i!=j)
{
cout<<i<<" "<<j<<endl;
vis[i]=1;
vis[j]=1;
break;
}
}
}
return 0;
}
codeforces 701A A. Cards(水题)的更多相关文章
- Codeforces Gym 100531G Grave 水题
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...
- codeforces 706A A. Beru-taxi(水题)
题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...
- codeforces 569B B. Inventory(水题)
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 489A SwapSort (水题)
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- codeforces 688A A. Opponents(水题)
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #356 (Div. 2) A. Bear and Five Cards 水题
A. Bear and Five Cards 题目连接: http://www.codeforces.com/contest/680/problem/A Description A little be ...
- Codeforces Round #304 (Div. 2) C. Soldier and Cards 水题
C. Soldier and Cards Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/546 ...
- codeforces 680A A. Bear and Five Cards(水题)
题目链接: A. Bear and Five Cards //#include <bits/stdc++.h> #include <vector> #include <i ...
- CodeForces 534B Covered Path (水题)
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...
随机推荐
- Resolving 'Root Partition Is Filling Up' Issue on Sophos UTM Firewall
from: https://wandersick.blogspot.com/2016/06/resolving-root-partition-is-filling-up.html This is a ...
- sql的一些知识_order by
注释 SELECT name FROM userinfo #这是注释 /* 这是多行注释 */ order by 排序() SELECT username FROM userinfo ORDER BY ...
- Item 51:写new和delete时请遵循惯例
Item 51: Adhere to convention when writing new and delete. Item 50介绍了怎样自己定义new和delete但没有解释你必须遵循的惯例. ...
- MySQL数据导入与导出
http://blog.chinaunix.net/uid-23354495-id-3188029.html mysql备份脚本之select into outfile
- C中參数个数可变的函数
一.什么是可变參数 我们在C语言编程中有时会遇到一些參数个数可变的函数,比如printf()函数,其函数原型为: int printf( const char* format, ...); 它除了有一 ...
- leetCode(51):Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- PHP 5.6编译安装
yum install openssl openssl-devel libxml2-devel libxml2 bzip2 bzip2-devel curl-devel php-mcrypt libm ...
- 关于mongorc.js文件详解
最近阅读了<<mongodb权威指南第二版>>,发现这本书比之前的第一版好,很多地方讲解很详细.下面就翻译下谈下这个文件. 首先,启动shell的时候,mongorc.js文件 ...
- MVC——分页
添加类PageBar.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
- ios6.0,程序为横屏,出现闪退
本文转载至 http://blog.csdn.net/huanghuanghbc/article/details/10150355 ios6.0,程序为横屏,出现闪退 *** Terminatin ...