HDU 1015 Safecracker

Source: Internet
Author: User

In fact, I think search = = violence, but search is in a more special way to achieve, so it sounds tall on the point, essentially and violence is a meaning

Do not know to write such a blind Dog eye code will be beaten by people ~

#include <iostream> #include <cstdio> #include <algorithm>using namespace Std;int rem[30];int main () { int target;string Ans;while (cin>>target>>ans&&target) {for (int i=0;i<ans.size (); i++) {Rem[i] =ans[i]-' A ' +1;} Sort (rem,rem+ans.size ()); int ll=ans.size () -1;for (int i=ll;i>=0;i--) {for (int. j=ll;j>=0;j--) {for (int k=ll;k) >=0;k--) {for (int l=ll;l>=0;l--) {for (int m=ll;m>=0;m--) {if (Rem[i]-rem[j]*rem[j]+rem[k]*rem[k]*rem[k]-rem [L]*rem[l]*rem[l]*rem[l]+rem[m]*rem[m]*rem[m]*rem[m]*rem[m]==target   &&i!=j&&j!=k&& K!=l&&l!=m) {Putchar (rem[i]-1+ ' a ');p Utchar (rem[j]-1+ ' a ');p Utchar (rem[k]-1+ ' a ');p Utchar (rem[l]-1+ ' a '); Putchar (rem[m]-1+ ' A '); goto fi;}}}} cout<< "no solution"; fi:cout<<endl;} return 0;}


HDU 1015 Safecracker

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.