题目链接:

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(水题)的更多相关文章

  1. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  2. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  3. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  4. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  5. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. 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 ...

  7. 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 ...

  8. codeforces 680A A. Bear and Five Cards(水题)

    题目链接: A. Bear and Five Cards //#include <bits/stdc++.h> #include <vector> #include <i ...

  9. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

随机推荐

  1. Android Base64转图片

    最近做一个项目里面有关于图片展示的需求,但是任性的后台跟我说没有图片服务器,只能给我base64让我自己转成图片,好吧,我忍,转就转吧.. 首先第一步咱还是谦虚点上百度查查别人咋转的,结果似乎各位码友 ...

  2. ubuntu配置django

    安装 安装Apache sudo apt-get install apache2 安装Django 下载Django 安装mod_wsgi sudo apt-get install libapache ...

  3. C#中通过反射获取类中非公有成员

    public class NGlbGlobeXComm { public static T GetPrivateField<T>(object instance, string field ...

  4. app后端开发系列文章文件夹

    一点废话 每个程序猿心中,都有一个大牛梦.我们在晨曦之光中敲击着代码,在寒冬覆雪中思考着0与1. 夏练三伏 冬练三九这说的就是我们这群[江湖]中人.在这里我们门派林立,C语言派历史悠久,在程序界就是嵩 ...

  5. [Django] 查看orm自己主动运行的原始查询sql

    django的文档看了非常多.也用了不少,有的时候感觉性能非常不好,知道非常多地方是惰性查询.可是对于复杂的逻辑.仅仅是表面上发现执行非常慢,机器资源消耗非常多.却不知道orm究竟是什么来转化成sql ...

  6. 一起talk C栗子吧(第八十四回:C语言实例--使用信号进行进程间通信一)

    各位看官们,大家好,上一回中咱们说的是进程间通信的样例.这一回咱们说的样例是:使用信号进行进程间通信.闲话休提,言归正转. 让我们一起talk C栗子吧! 我们在上一回中提到过进程之间通信须要解决的三 ...

  7. Phpstorm 放大字体的快捷键是什么?

      这个功能需要设置才能使用: 步骤:control+shift+A功能可以搜索对应功能 输入mouse 设置Change font size(Zoom) ...的按钮打开,然后就可以通过 ctrl+ ...

  8. 配置Office Outlook 2013

    导航 背景——配置过程——错误(Error)——参考资料 背景 最近,折腾了一阵子邮箱客户端,包括:Foxmail.thuderbird.outlook:最后,考虑到outlook对文本的强大的支持能 ...

  9. linux 信号屏蔽

    <span style="font-size:18px;">#include <sys/types.h> #include <unistd.h> ...

  10. Mataplotlib绘图和可视化

    Mataplotlib是一个强大的python绘图和数据可视化工具包 安装方法:pip install matplotlib 引用方法:import matplotlib.pyplot as plt ...