题目传送门

 /*
暴力:纯暴力,在家水水
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
char s[];
int v[];
int len, tar; bool cmp(int x, int y) {return x > y;} void work(void)
{
for (int i=; i<len; ++i)
{
for (int j=; j<len; ++j)
{
if (i != j)
{
for (int k=; k<len; ++k)
{
if (k != i && k != j)
{
for (int l=; l<len; ++l)
{
if (l != i && l != j && l != k)
{
for (int m=; m<len; ++m)
{
if (m != i && m != j && m != k && m != l)
{
if (v[i] - pow (v[j], ) + pow (v[k], ) - pow (v[l], ) + pow (v[m], ) == tar)
{
printf ("%c%c%c%c%c\n", v[i] + 'A' - , v[j] + 'A' - , v[k] + 'A' - , v[l] + 'A' - , v[m] + 'A' - );
return ;
}
}
}
}
}
}
}
}
}
} printf ("no solution\n");
} int main(void) //ZOJ 1403 Safecracker
{
// freopen ("ZOJ_1403.in", "r", stdin); while (scanf ("%d%s", &tar, &s) == )
{
if (tar == && strcmp (s, "END") == ) break;
len = strlen (s);
for (int i=; i<len; ++i) v[i] = s[i] - 'A' + ;
sort (v, v+len, cmp); work ();
} return ;
} /*
v - w^2 + x^3 - y^4 + z^5 = target
*/

暴力 ZOJ 1403 Safecracker的更多相关文章

  1. ZOJ 1403&&HDU 1015 Safecracker【暴力】

    Safecracker Time Limit: 2 Seconds      Memory Limit: 65536 KB === Op tech briefing, 2002/11/02 06:42 ...

  2. [ACM_暴力] ZOJ 3710 [Friends 共同认识 最终认识 暴力]

    Alice lives in the country where people like to make friends. The friendship is bidirectional and if ...

  3. ZOJ 1403 解密

    参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6412212.htmlSafecracker Time Limit: 2 Seconds       ...

  4. ZOJ 1403 F-Safecracker

    https://vjudge.net/contest/67836#problem/F "The item is locked in a Klein safe behind a paintin ...

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

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

  6. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  7. 【ZOJ】3785 What day is that day? ——浅谈KMP在ACM竞赛中的暴力打表找规律中的应用

    转载请声明出处:http://www.cnblogs.com/kevince/p/3887827.html    ——By Kevince 首先声明一下,这里的规律指的是循环,即找到最小循环周期. 这 ...

  8. hdu1015 Safecracker (暴力枚举)

    http://acm.hdu.edu.cn/showproblem.php?pid=1015 Safecracker Time Limit: 2000/1000 MS (Java/Others)    ...

  9. HDU 1015.Safecracker【暴力枚举】【8月17】

    Safecracker Problem Description === Op tech briefing, 2002/11/02 06:42 CST ===  "The item is lo ...

随机推荐

  1. Failed to load session “ubuntu" 问题解决总结

    最近在用Ubuntu系统,但因为手欠,将unity-2d给删除了,导致总是进不了图形界面,登陆之后显示failed to load session "ubuntu“,返回之后又回到登录界面. ...

  2. c++多线程编程:常见面试题

    题目:子线程循环 10 次,接着主线程循环 100 次,接着又回到子线程循环 10 次,接着再回到主线程又循环 100 次,如此循环50次,试写出代码 子线程与主线程必有一个满足条件(flag == ...

  3. 【python】Python的字典get方法:从字典中获取一个值

    转自: http://blog.sina.com.cn/s/blog_6be89284010183xm.html

  4. apc smart UPS下使用apcupsd注意事项

    公司的apc smart UPS安装有管理卡(似乎是AP-9631),server环境有FreeBSD.Windows Server.Linux(CentOS.Ubuntu) 实际使用中有例如以下问题 ...

  5. [Angular] Communicate Between Components Using Angular Dependency Injection

    Allow more than one child component of the same type. Allow child components to be placed within the ...

  6. 为RAC私有网络配置网卡Bonding

    在RAC的安装部署过程中.并不不过简单的安装完毕了事.整个安装过程要考虑可能出现的单点问题,当中比較重要的是私有网络. 私有网络是RAC节点间通信的通道.包含节点间的网络心跳信息.Cache fusi ...

  7. Redis和Memcache性能测试对比

    Redis和Memcache在写入性能上面差别不大,读取性能上面尤其是批量读取性能上面Memcache全面胜出,当然Redis也有自己的优点:比如数据持久化.支持更多的数据结构(Set List ZS ...

  8. 基于开源项目的在线网络视频直播项目---一个很好的电视直播开源项目Sopcast

    http://blog.csdn.net/roy_xu/article/details/2216559 http://115.com/?ct=rar&pickcode=ew52634xr2cr ...

  9. HDU1251 统计难题 【trie树】

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others) Total Subm ...

  10. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) E. Prairie Partition 二分+贪心

    E. Prairie Partition It can be shown that any positive integer x can be uniquely represented as x =  ...