BestCoder 2nd Anniversary:

1001.Oracle

There is once a king and queen, rulers of an unnamed city, who have three daughters of conspicuous beauty.

The youngest and most beautiful is Psyche, whose admirers, neglecting the proper worship of the love goddess Venus, instead pray and make offerings to her. Her father, the king, is desperate to know about her destiny, so he comes to the Delphi Temple to ask for an oracle.

The oracle is an integer n n n without leading zeroes.

To get the meaning, he needs to rearrange the digits and split the number into two positive integers without leading zeroes, and their sum should be as large as possible.

Help him to work out the maximum sum. It might be impossible to do that. If so, print Uncertain.

数据比较大,用字符串输入,要处理进位

#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
using namespace std;
#define LL long long
#define M 100010
#define inf 0x7f7f7f7f
#define PI 3.1415926
#define mod 1000000007
int n,m;
int a[];
void dfs()
{ }
int main()
{
scanf("%d",&n);
while(n--)
{
int sum=,ave=;
scanf("%d",&m);
for(int i=;i<m;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
ave=sum/;
sort(a,a+m);
if(sum%||ave<a[m-]||m<)
{
printf("no\n");
continue;
} }
}

(16/7/17)

Best code水题之路的更多相关文章

  1. HDU 4813 Hard Code 水题

    Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  2. Codeforces Round #339 (Div. 2) B. Gena's Code 水题

    B. Gena's Code 题目连接: http://www.codeforces.com/contest/614/problem/B Description It's the year 4527 ...

  3. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  4. CODE FESTIVAL 2017 qual B B - Problem Set【水题,stl map】

    CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: ...

  5. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar 水题

    A. Checking the Calendar 题目连接: http://codeforces.com/contest/724/problem/A Description You are given ...

  6. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  7. 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A: The 3n + 1 problem(水题)

    Problem A: The 3n + 1 problem Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 14  Solved: 6[Submit][St ...

  8. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  9. hdu 2050:折线分割平面(水题,递归)

    折线分割平面 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

随机推荐

  1. 配置本机IIS服务器

    1.控制面板---程序---(程序和功能) 安装完成之后就可以访问本地的localhost 2.进入防火墙界面--高级设置 至此开放端口完成

  2. 小猪cms ClassifyAction.class.php

    <?php /** *语音回复 **/ class ClassifyAction extends UserAction{ public $fid; public function _initia ...

  3. 5 HTML&JS等前端知识系列之jquery基础

    preface jquery其实就是对javascript的再次封装,方便我们开发者调用,下载地址是:http://jquery.com/download/ ,下面就说说常用使用方法 选择器 基本选择 ...

  4. js时间戳与日期格式之间的转换

    转换方法: var date = new Date(时间戳); //获取一个时间对象  注意:如果是uinx时间戳记得乘于1000. 比如php函数time()获得的时间戳就要乘于1000 //获取时 ...

  5. Python操作MySQL

    本篇对于Python操作MySQL主要使用两种方式: 原生模块 pymsql ORM框架 SQLAchemy pymsql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb ...

  6. mybatis generator.xml 配置 自动生成model,dao,mapping

    generator.xml文件: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE gener ...

  7. Linux查看tomcat 控制台输出命令

    用远程登陆客户端登陆linux进入tomcat/logs/文件夹下键入指令:tail -f catalina.out

  8. 深入理解JSX

    本文由笔者翻译自官方文档的JSX In Depth,若干案例经过了改写.其实说白了也好像不算太深入,但还是提示了一些可能的盲区. JSX是为构造React元素方法React.createElement ...

  9. Spring Boot整合Dubbo框架demo

    Dubbo框架原理见之前的博文:http://www.cnblogs.com/umgsai/p/5836925.html 首先启动zookeeper Server端 Pom配置如下 <?xml ...

  10. 最长回文子串(Longest Palindromic Substring)

    这算是一道经典的题目了,最长回文子串问题是在一个字符串中求得满足回文子串条件的最长的那一个.常见的解题方法有三种: (1)暴力枚举法,以每个元素为中心同时向左和向右出发,复杂度O(n^2): (2)动 ...