标签:
By replacing each of the letters in the word CARE with 1, 2, 9, and 6 respectively, we form a square number: 1296 = 362. What is remarkable is that, by using the same digital substitutions, the anagram, RACE, also forms a square number: 9216 = 962. We shall call CARE (and RACE) a square anagram word pair and specify further that leading zeroes are not permitted, neither may a different letter have the same digital value as another letter.
Using words.txt (right click and ‘Save Link/Target As…’), a 16K text file containing nearly two-thousand common English words, find all the square anagram word pairs (a palindromic word is NOT considered to be an anagram of itself).
What is the largest square number formed by any member of such a pair?
NOTE: All anagrams formed must be contained in the given text file.
将单词CARE中的四个字母依次赋值为1、2、9、6,我们得到了一个平方数:1296 = 362。神奇的是,使用同样的数字赋值,重排后的单词RACE同样构成了一个平方数:9216 = 962。我们称CARE和RACE为重排平方单词对,同时规定这样的单词对不允许有前导零或是不同的字母赋相同的值。
在这个16K的文本文件words.txt(右击并选择“目标另存为……”)中包含了将近两千个常见英文单词,找出所有的重排平方单词对(一个回文单词不视为它自己的重排)。
重排平方单词对所给出的最大平方数是多少?
注意:所有的重排单词必须出现在给定的文本文件中。
解题
先说下自己的思路:
1.words文件中找出又相同字母组成的单词对
2.构造平方数,筛选由相同数字组成的平方数
3.关键的就是单词和数字的映射关系,特别是位置要做到对应,但是我只能保证字母和数字映射后,可以组成的数字是平方数,但是数字的顺序字母映射的顺序不一样,造成输出的结果比较多。
Java
package Level3; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; public class PE098{ // 下面结果输出的比较多,其实求最大值也是不对的,但是但是,答案就在输出的结果中 // 输出的两个单词由相同字母组成,输出的两个数字是两个平方数并且含有相同的数字,但是但是,两个单词字母的位置和数字的位置不是对应的 // 如果能够让他们一一对应,答案应该就是唯一的了。在对两个单词和数字匹配的时候,程序还需要完善 public static void run() throws IOException{ // 相同字母的单词对 ArrayList<ArrayList<String>> dicts = getAnagramic(); // 相同数字的平方数 ArrayList<ArrayList<Integer>> anagNum = AnagNum(); for(int i=0;i<dicts.size();i++){ ArrayList<String> dict = new ArrayList<String>(); dict = dicts.get(i); for(int j=0;j<anagNum.size();j++){ ArrayList<Integer> num = new ArrayList<Integer>(); num = anagNum.get(j); if(isReplace(dict.get(0),dict.get(1),num.get(0)) && isReplace(dict.get(1),dict.get(0),num.get(1))) System.out.println(dict.get(0)+"\t"+dict.get(1)+"\t"+num.get(0)+"\t" + num.get(1)); } } } // str1 str2 是相同字母组成的单词,看看是否都和num可以匹配 public static boolean isReplace(String str1,String str2,int num1){ int strlen = str1.length(); int numlen = String.valueOf(num1).length(); if(numlen!= strlen) return false; int[] A = new int[strlen]; String[] B = new String[10]; int tmp = num1; HashMap<Character,Integer> mapraw = new HashMap<Character,Integer>(); HashMap<Character,Integer> mapall = new HashMap<Character,Integer>(); for(int i=strlen-1;i>=0;i--){ char ch = str1.charAt(i); //相同字母不能有相同的value if(mapraw.containsValue(num1%10) == true) return false; mapraw.put(ch, num1%10); if(mapall.containsKey(ch)==false) mapall.put(ch, num1%10); else{ mapall.put(ch, mapall.get(ch)+num1%10); } num1/=10; } for(int i=0;i<strlen;i++){ char ch = str2.charAt(i); if(mapall.containsKey(ch) == false) return false; else{ mapall.put(ch,mapall.get(ch) - mapraw.get(ch)); } } for(int i=0;i<strlen;i++){ char ch = str1.charAt(i); int value = mapall.get(ch); if(value!=0) return false; } // 上面的程序只是判断了str1 和num1进行映射后 str2也可以这样搞, return true; } // 获取相同数字的平方数对 public static ArrayList<ArrayList<Integer>> AnagNum(){ ArrayList<ArrayList<Integer>> anagNum = new ArrayList<ArrayList<Integer>>(); ArrayList<Integer> squares = new ArrayList<Integer>(); int MAX = 999999; int i = 11; // 构造平方数 while(true){ if(i*i>=MAX) break; squares.add(i*i); i++; } //寻找相同数字的数 for(i=0;i<squares.size();i++){ int num1 = squares.get(i); for(int j=i+1;j<squares.size();j++){ int num2 = squares.get(j); if(isDiff(num1,num2)){ // 相同数字的平方数,两个两个数的保存 ArrayList<Integer> num = new ArrayList<Integer>(); num.add(num1); num.add(num2); anagNum.add(num); } } } // System.out.println(anagNum.size()); // for(i=0;i<anagNum.size();i++){ // ArrayList<Integer> num = new ArrayList<Integer>(); // num = anagNum.get(i); // for(int j =0;j<num.size();j++){ // System.out.print(num.get(j)+"\t"); // } // System.out.println(); // } return anagNum; } public static ArrayList<ArrayList<String>> getAnagramic() throws IOException { ArrayList<String> words = getWords(); ArrayList<ArrayList<String>> dicts = new ArrayList<ArrayList<String>>(); //暴力遍历,找到相同字母的单词 for(int i=0;i<words.size();i++){ String tmp1 = words.get(i); for(int j=i+1;j<words.size();j++){ String tmp2 = words.get(j); if(isDiff(tmp1,tmp2)){ // 相同字母的单词,两个两个的保存 ArrayList<String> dict = new ArrayList<String>(); dict.add(tmp1); dict.add(tmp2); dicts.add(dict); } } // 相同字母单词的个数 大于 1 // if(dict.size()>=2) // dicts.add(dict); } int size = dicts.size(); // 输出相同字母的单词对 // for(int i=0;i<dicts.size(); i++){ // ArrayList<String> dict = new ArrayList<String>(); // dict = dicts.get(i); // for(int j=0;j<dict.size();j++){ // System.out.print(dict.get(j)+"\t"); // } // System.out.println(); // } // System.out.println(size); return dicts; } // 读取单词表 public static ArrayList<String> getWords() throws IOException{ String filename = "src/Level3/p098_words.txt"; ArrayList<String> words = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new FileReader(filename)); String data = reader.readLine(); data = data.replace("\"", ""); // System.out.println(data); String[] dictArray = data.split(","); for(int i=0;i<dictArray.length;i++){ // System.out.println(dictArray[i]); words.add(dictArray[i]); } // System.out.println(dictArray.length); return words; } public static boolean isDiff(String str1,String str2){ int len1 = str1.length(); int len2 = str2.length(); if(len1!=len2) return false; int diff[] = new int[26]; for(int i=0;i<len1;i++){ diff[str1.charAt(i) - ‘A‘]++; diff[str2.charAt(i) - ‘A‘]--; } for(int i=0;i<26;i++) if(diff[i]!=0) return false; return true; } public static boolean isDiff(int num1,int num2){ int len1 = (num1+"").length(); int len2 = (num2+"").length(); if(len1!=len2) return false; int diff[] = new int[10]; while(num1!=0 ||num2!=0){ diff[num1%10]++; diff[num2%10]--; num1/=10; num2/=10; } for(int i=0;i<10;i++) if(diff[i]!=0) return false; return true; } public static void main(String[] args) throws IOException { long t0 = System.currentTimeMillis(); run(); long t1 = System.currentTimeMillis(); long t = t1 - t0; System.out.println("running time="+t/1000+"s"+t%1000+"ms"); } }
输出结果
ACT CAT 169 196 ACT CAT 169 961 ACT CAT 196 961 ACT CAT 256 625 ARISE RAISE 12769 96721 ARISE RAISE 16384 31684 ARISE RAISE 16384 36481 ARISE RAISE 16384 38416 ARISE RAISE 16384 43681 ARISE RAISE 17689 18769 ARISE RAISE 17689 78961 ARISE RAISE 17689 81796 ARISE RAISE 18769 78961 ARISE RAISE 18769 81796 ARISE RAISE 20736 30276 ARISE RAISE 21904 41209 ARISE RAISE 21904 91204 ARISE RAISE 23104 32041 ARISE RAISE 23409 39204 ARISE RAISE 23716 32761 ARISE RAISE 23716 72361 ARISE RAISE 29584 54289 ARISE RAISE 31684 36481 ARISE RAISE 31684 38416 ARISE RAISE 31684 43681 ARISE RAISE 32761 72361 ARISE RAISE 34596 45369 ARISE RAISE 36481 38416 ARISE RAISE 36481 43681 ARISE RAISE 38416 43681 ARISE RAISE 41209 91204 ARISE RAISE 50176 51076 ARISE RAISE 51984 95481 ARISE RAISE 74529 79524 ARISE RAISE 78961 81796 BOARD BROAD 12769 96721 BOARD BROAD 16384 31684 BOARD BROAD 16384 36481 BOARD BROAD 16384 38416 BOARD BROAD 16384 43681 BOARD BROAD 17689 18769 BOARD BROAD 17689 78961 BOARD BROAD 17689 81796 BOARD BROAD 18769 78961 BOARD BROAD 18769 81796 BOARD BROAD 20736 30276 BOARD BROAD 21904 41209 BOARD BROAD 21904 91204 BOARD BROAD 23104 32041 BOARD BROAD 23409 39204 BOARD BROAD 23716 32761 BOARD BROAD 23716 72361 BOARD BROAD 29584 54289 BOARD BROAD 31684 36481 BOARD BROAD 31684 38416 BOARD BROAD 31684 43681 BOARD BROAD 32761 72361 BOARD BROAD 34596 45369 BOARD BROAD 36481 38416 BOARD BROAD 36481 43681 BOARD BROAD 38416 43681 BOARD BROAD 41209 91204 BOARD BROAD 50176 51076 BOARD BROAD 51984 95481 BOARD BROAD 74529 79524 BOARD BROAD 78961 81796 CARE RACE 1024 2401 CARE RACE 1089 9801 CARE RACE 1296 2916 CARE RACE 1296 9216 CARE RACE 1369 1936 CARE RACE 1764 4761 CARE RACE 2916 9216 CARE RACE 4096 9604 COURSE SOURCE 103684 638401 COURSE SOURCE 103684 813604 COURSE SOURCE 103684 863041 COURSE SOURCE 104329 123904 COURSE SOURCE 104329 310249 COURSE SOURCE 104976 710649 COURSE SOURCE 123904 310249 COURSE SOURCE 124609 162409 COURSE SOURCE 132496 214369 COURSE SOURCE 132496 346921 COURSE SOURCE 132496 436921 COURSE SOURCE 139876 391876 COURSE SOURCE 140625 164025 COURSE SOURCE 140625 254016 COURSE SOURCE 140625 416025 COURSE SOURCE 140625 501264 COURSE SOURCE 157609 170569 COURSE SOURCE 164025 254016 COURSE SOURCE 164025 416025 COURSE SOURCE 164025 501264 COURSE SOURCE 180625 502681 COURSE SOURCE 195364 351649 COURSE SOURCE 195364 395641 COURSE SOURCE 195364 543169 COURSE SOURCE 198025 259081 COURSE SOURCE 198025 819025 COURSE SOURCE 207936 603729 COURSE SOURCE 214369 346921 COURSE SOURCE 214369 436921 COURSE SOURCE 237169 729316 COURSE SOURCE 254016 416025 COURSE SOURCE 254016 501264 COURSE SOURCE 257049 497025 COURSE SOURCE 257049 725904 COURSE SOURCE 258064 605284 COURSE SOURCE 258064 648025 COURSE SOURCE 259081 819025 COURSE SOURCE 293764 329476 COURSE SOURCE 318096 613089 COURSE SOURCE 321489 349281 COURSE SOURCE 321489 381924 COURSE SOURCE 346921 436921 COURSE SOURCE 349281 381924 COURSE SOURCE 351649 395641 COURSE SOURCE 351649 543169 COURSE SOURCE 390625 635209 COURSE SOURCE 395641 543169 COURSE SOURCE 405769 470596 COURSE SOURCE 408321 423801 COURSE SOURCE 416025 501264 COURSE SOURCE 497025 725904 COURSE SOURCE 508369 839056 COURSE SOURCE 514089 549081 COURSE SOURCE 514089 815409 COURSE SOURCE 549081 815409 COURSE SOURCE 605284 648025 COURSE SOURCE 638401 813604 COURSE SOURCE 638401 863041 COURSE SOURCE 703921 790321 COURSE SOURCE 758641 781456 COURSE SOURCE 813604 863041 CREDIT DIRECT 103684 638401 CREDIT DIRECT 103684 813604 CREDIT DIRECT 103684 863041 CREDIT DIRECT 104329 123904 CREDIT DIRECT 104329 310249 CREDIT DIRECT 104976 710649 CREDIT DIRECT 123904 310249 CREDIT DIRECT 124609 162409 CREDIT DIRECT 132496 214369 CREDIT DIRECT 132496 346921 CREDIT DIRECT 132496 436921 CREDIT DIRECT 139876 391876 CREDIT DIRECT 140625 164025 CREDIT DIRECT 140625 254016 CREDIT DIRECT 140625 416025 CREDIT DIRECT 140625 501264 CREDIT DIRECT 157609 170569 CREDIT DIRECT 164025 254016 CREDIT DIRECT 164025 416025 CREDIT DIRECT 164025 501264 CREDIT DIRECT 180625 502681 CREDIT DIRECT 195364 351649 CREDIT DIRECT 195364 395641 CREDIT DIRECT 195364 543169 CREDIT DIRECT 198025 259081 CREDIT DIRECT 198025 819025 CREDIT DIRECT 207936 603729 CREDIT DIRECT 214369 346921 CREDIT DIRECT 214369 436921 CREDIT DIRECT 237169 729316 CREDIT DIRECT 254016 416025 CREDIT DIRECT 254016 501264 CREDIT DIRECT 257049 497025 CREDIT DIRECT 257049 725904 CREDIT DIRECT 258064 605284 CREDIT DIRECT 258064 648025 CREDIT DIRECT 259081 819025 CREDIT DIRECT 293764 329476 CREDIT DIRECT 318096 613089 CREDIT DIRECT 321489 349281 CREDIT DIRECT 321489 381924 CREDIT DIRECT 346921 436921 CREDIT DIRECT 349281 381924 CREDIT DIRECT 351649 395641 CREDIT DIRECT 351649 543169 CREDIT DIRECT 390625 635209 CREDIT DIRECT 395641 543169 CREDIT DIRECT 405769 470596 CREDIT DIRECT 408321 423801 CREDIT DIRECT 416025 501264 CREDIT DIRECT 497025 725904 CREDIT DIRECT 508369 839056 CREDIT DIRECT 514089 549081 CREDIT DIRECT 514089 815409 CREDIT DIRECT 549081 815409 CREDIT DIRECT 605284 648025 CREDIT DIRECT 638401 813604 CREDIT DIRECT 638401 863041 CREDIT DIRECT 703921 790321 CREDIT DIRECT 758641 781456 CREDIT DIRECT 813604 863041 DANGER GARDEN 103684 638401 DANGER GARDEN 103684 813604 DANGER GARDEN 103684 863041 DANGER GARDEN 104329 123904 DANGER GARDEN 104329 310249 DANGER GARDEN 104976 710649 DANGER GARDEN 123904 310249 DANGER GARDEN 124609 162409 DANGER GARDEN 132496 214369 DANGER GARDEN 132496 346921 DANGER GARDEN 132496 436921 DANGER GARDEN 139876 391876 DANGER GARDEN 140625 164025 DANGER GARDEN 140625 254016 DANGER GARDEN 140625 416025 DANGER GARDEN 140625 501264 DANGER GARDEN 157609 170569 DANGER GARDEN 164025 254016 DANGER GARDEN 164025 416025 DANGER GARDEN 164025 501264 DANGER GARDEN 180625 502681 DANGER GARDEN 195364 351649 DANGER GARDEN 195364 395641 DANGER GARDEN 195364 543169 DANGER GARDEN 198025 259081 DANGER GARDEN 198025 819025 DANGER GARDEN 207936 603729 DANGER GARDEN 214369 346921 DANGER GARDEN 214369 436921 DANGER GARDEN 237169 729316 DANGER GARDEN 254016 416025 DANGER GARDEN 254016 501264 DANGER GARDEN 257049 497025 DANGER GARDEN 257049 725904 DANGER GARDEN 258064 605284 DANGER GARDEN 258064 648025 DANGER GARDEN 259081 819025 DANGER GARDEN 293764 329476 DANGER GARDEN 318096 613089 DANGER GARDEN 321489 349281 DANGER GARDEN 321489 381924 DANGER GARDEN 346921 436921 DANGER GARDEN 349281 381924 DANGER GARDEN 351649 395641 DANGER GARDEN 351649 543169 DANGER GARDEN 390625 635209 DANGER GARDEN 395641 543169 DANGER GARDEN 405769 470596 DANGER GARDEN 408321 423801 DANGER GARDEN 416025 501264 DANGER GARDEN 497025 725904 DANGER GARDEN 508369 839056 DANGER GARDEN 514089 549081 DANGER GARDEN 514089 815409 DANGER GARDEN 549081 815409 DANGER GARDEN 605284 648025 DANGER GARDEN 638401 813604 DANGER GARDEN 638401 863041 DANGER GARDEN 703921 790321 DANGER GARDEN 758641 781456 DANGER GARDEN 813604 863041 DEAL LEAD 1024 2401 DEAL LEAD 1089 9801 DEAL LEAD 1296 2916 DEAL LEAD 1296 9216 DEAL LEAD 1369 1936 DEAL LEAD 1764 4761 DEAL LEAD 2916 9216 DEAL LEAD 4096 9604 DOG GOD 169 196 DOG GOD 169 961 DOG GOD 196 961 DOG GOD 256 625 EARN NEAR 1024 2401 EARN NEAR 1089 9801 EARN NEAR 1296 2916 EARN NEAR 1296 9216 EARN NEAR 1369 1936 EARN NEAR 1764 4761 EARN NEAR 2916 9216 EARN NEAR 4096 9604 EARTH HEART 12769 96721 EARTH HEART 16384 31684 EARTH HEART 16384 36481 EARTH HEART 16384 38416 EARTH HEART 16384 43681 EARTH HEART 17689 18769 EARTH HEART 17689 78961 EARTH HEART 17689 81796 EARTH HEART 18769 78961 EARTH HEART 18769 81796 EARTH HEART 20736 30276 EARTH HEART 21904 41209 EARTH HEART 21904 91204 EARTH HEART 23104 32041 EARTH HEART 23409 39204 EARTH HEART 23716 32761 EARTH HEART 23716 72361 EARTH HEART 29584 54289 EARTH HEART 31684 36481 EARTH HEART 31684 38416 EARTH HEART 31684 43681 EARTH HEART 32761 72361 EARTH HEART 34596 45369 EARTH HEART 36481 38416 EARTH HEART 36481 43681 EARTH HEART 38416 43681 EARTH HEART 41209 91204 EARTH HEART 50176 51076 EARTH HEART 51984 95481 EARTH HEART 74529 79524 EARTH HEART 78961 81796 EAST SEAT 1024 2401 EAST SEAT 1089 9801 EAST SEAT 1296 2916 EAST SEAT 1296 9216 EAST SEAT 1369 1936 EAST SEAT 1764 4761 EAST SEAT 2916 9216 EAST SEAT 4096 9604 EAT TEA 169 196 EAT TEA 169 961 EAT TEA 196 961 EAT TEA 256 625 FILE LIFE 1024 2401 FILE LIFE 1089 9801 FILE LIFE 1296 2916 FILE LIFE 1296 9216 FILE LIFE 1369 1936 FILE LIFE 1764 4761 FILE LIFE 2916 9216 FILE LIFE 4096 9604 FORM FROM 1024 2401 FORM FROM 1089 9801 FORM FROM 1296 2916 FORM FROM 1296 9216 FORM FROM 1369 1936 FORM FROM 1764 4761 FORM FROM 2916 9216 FORM FROM 4096 9604 HATE HEAT 1024 2401 HATE HEAT 1089 9801 HATE HEAT 1296 2916 HATE HEAT 1296 9216 HATE HEAT 1369 1936 HATE HEAT 1764 4761 HATE HEAT 2916 9216 HATE HEAT 4096 9604 HOW WHO 169 196 HOW WHO 169 961 HOW WHO 196 961 HOW WHO 256 625 IGNORE REGION 103684 638401 IGNORE REGION 103684 813604 IGNORE REGION 103684 863041 IGNORE REGION 104329 123904 IGNORE REGION 104329 310249 IGNORE REGION 104976 710649 IGNORE REGION 123904 310249 IGNORE REGION 124609 162409 IGNORE REGION 132496 214369 IGNORE REGION 132496 346921 IGNORE REGION 132496 436921 IGNORE REGION 139876 391876 IGNORE REGION 140625 164025 IGNORE REGION 140625 254016 IGNORE REGION 140625 416025 IGNORE REGION 140625 501264 IGNORE REGION 157609 170569 IGNORE REGION 164025 254016 IGNORE REGION 164025 416025 IGNORE REGION 164025 501264 IGNORE REGION 180625 502681 IGNORE REGION 195364 351649 IGNORE REGION 195364 395641 IGNORE REGION 195364 543169 IGNORE REGION 198025 259081 IGNORE REGION 198025 819025 IGNORE REGION 207936 603729 IGNORE REGION 214369 346921 IGNORE REGION 214369 436921 IGNORE REGION 237169 729316 IGNORE REGION 254016 416025 IGNORE REGION 254016 501264 IGNORE REGION 257049 497025 IGNORE REGION 257049 725904 IGNORE REGION 258064 605284 IGNORE REGION 258064 648025 IGNORE REGION 259081 819025 IGNORE REGION 293764 329476 IGNORE REGION 318096 613089 IGNORE REGION 321489 349281 IGNORE REGION 321489 381924 IGNORE REGION 346921 436921 IGNORE REGION 349281 381924 IGNORE REGION 351649 395641 IGNORE REGION 351649 543169 IGNORE REGION 390625 635209 IGNORE REGION 395641 543169 IGNORE REGION 405769 470596 IGNORE REGION 408321 423801 IGNORE REGION 416025 501264 IGNORE REGION 497025 725904 IGNORE REGION 508369 839056 IGNORE REGION 514089 549081 IGNORE REGION 514089 815409 IGNORE REGION 549081 815409 IGNORE REGION 605284 648025 IGNORE REGION 638401 813604 IGNORE REGION 638401 863041 IGNORE REGION 703921 790321 IGNORE REGION 758641 781456 IGNORE REGION 813604 863041 ITEM TIME 1024 2401 ITEM TIME 1089 9801 ITEM TIME 1296 2916 ITEM TIME 1296 9216 ITEM TIME 1369 1936 ITEM TIME 1764 4761 ITEM TIME 2916 9216 ITEM TIME 4096 9604 ITS SIT 169 196 ITS SIT 169 961 ITS SIT 196 961 ITS SIT 256 625 LEAST STEAL 12769 96721 LEAST STEAL 16384 31684 LEAST STEAL 16384 36481 LEAST STEAL 16384 38416 LEAST STEAL 16384 43681 LEAST STEAL 17689 18769 LEAST STEAL 17689 78961 LEAST STEAL 17689 81796 LEAST STEAL 18769 78961 LEAST STEAL 18769 81796 LEAST STEAL 20736 30276 LEAST STEAL 21904 41209 LEAST STEAL 21904 91204 LEAST STEAL 23104 32041 LEAST STEAL 23409 39204 LEAST STEAL 23716 32761 LEAST STEAL 23716 72361 LEAST STEAL 29584 54289 LEAST STEAL 31684 36481 LEAST STEAL 31684 38416 LEAST STEAL 31684 43681 LEAST STEAL 32761 72361 LEAST STEAL 34596 45369 LEAST STEAL 36481 38416 LEAST STEAL 36481 43681 LEAST STEAL 38416 43681 LEAST STEAL 41209 91204 LEAST STEAL 50176 51076 LEAST STEAL 51984 95481 LEAST STEAL 74529 79524 LEAST STEAL 78961 81796 MALE MEAL 1024 2401 MALE MEAL 1089 9801 MALE MEAL 1296 2916 MALE MEAL 1296 9216 MALE MEAL 1369 1936 MALE MEAL 1764 4761 MALE MEAL 2916 9216 MALE MEAL 4096 9604 MEAN NAME 1024 2401 MEAN NAME 1089 9801 MEAN NAME 1296 2916 MEAN NAME 1296 9216 MEAN NAME 1369 1936 MEAN NAME 1764 4761 MEAN NAME 2916 9216 MEAN NAME 4096 9604 NIGHT THING 12769 96721 NIGHT THING 16384 31684 NIGHT THING 16384 36481 NIGHT THING 16384 38416 NIGHT THING 16384 43681 NIGHT THING 17689 18769 NIGHT THING 17689 78961 NIGHT THING 17689 81796 NIGHT THING 18769 78961 NIGHT THING 18769 81796 NIGHT THING 20736 30276 NIGHT THING 21904 41209 NIGHT THING 21904 91204 NIGHT THING 23104 32041 NIGHT THING 23409 39204 NIGHT THING 23716 32761 NIGHT THING 23716 72361 NIGHT THING 29584 54289 NIGHT THING 31684 36481 NIGHT THING 31684 38416 NIGHT THING 31684 43681 NIGHT THING 32761 72361 NIGHT THING 34596 45369 NIGHT THING 36481 38416 NIGHT THING 36481 43681 NIGHT THING 38416 43681 NIGHT THING 41209 91204 NIGHT THING 50176 51076 NIGHT THING 51984 95481 NIGHT THING 74529 79524 NIGHT THING 78961 81796 NOTE TONE 1024 2401 NOTE TONE 1089 9801 NOTE TONE 1296 2916 NOTE TONE 1296 9216 NOTE TONE 1369 1936 NOTE TONE 1764 4761 NOTE TONE 2916 9216 NOTE TONE 4096 9604 NOW OWN 169 196 NOW OWN 169 961 NOW OWN 196 961 NOW OWN 256 625 PHASE SHAPE 12769 96721 PHASE SHAPE 16384 31684 PHASE SHAPE 16384 36481 PHASE SHAPE 16384 38416 PHASE SHAPE 16384 43681 PHASE SHAPE 17689 18769 PHASE SHAPE 17689 78961 PHASE SHAPE 17689 81796 PHASE SHAPE 18769 78961 PHASE SHAPE 18769 81796 PHASE SHAPE 20736 30276 PHASE SHAPE 21904 41209 PHASE SHAPE 21904 91204 PHASE SHAPE 23104 32041 PHASE SHAPE 23409 39204 PHASE SHAPE 23716 32761 PHASE SHAPE 23716 72361 PHASE SHAPE 29584 54289 PHASE SHAPE 31684 36481 PHASE SHAPE 31684 38416 PHASE SHAPE 31684 43681 PHASE SHAPE 32761 72361 PHASE SHAPE 34596 45369 PHASE SHAPE 36481 38416 PHASE SHAPE 36481 43681 PHASE SHAPE 38416 43681 PHASE SHAPE 41209 91204 PHASE SHAPE 50176 51076 PHASE SHAPE 51984 95481 PHASE SHAPE 74529 79524 PHASE SHAPE 78961 81796 POST SPOT 1024 2401 POST SPOT 1089 9801 POST SPOT 1296 2916 POST SPOT 1296 9216 POST SPOT 1369 1936 POST SPOT 1764 4761 POST SPOT 2916 9216 POST SPOT 4096 9604 POST STOP 1024 2401 POST STOP 1089 9801 POST STOP 1296 2916 POST STOP 1296 9216 POST STOP 1369 1936 POST STOP 1764 4761 POST STOP 2916 9216 POST STOP 4096 9604 QUIET QUITE 12769 96721 QUIET QUITE 16384 31684 QUIET QUITE 16384 36481 QUIET QUITE 16384 38416 QUIET QUITE 16384 43681 QUIET QUITE 17689 18769 QUIET QUITE 17689 78961 QUIET QUITE 17689 81796 QUIET QUITE 18769 78961 QUIET QUITE 18769 81796 QUIET QUITE 20736 30276 QUIET QUITE 21904 41209 QUIET QUITE 21904 91204 QUIET QUITE 23104 32041 QUIET QUITE 23409 39204 QUIET QUITE 23716 32761 QUIET QUITE 23716 72361 QUIET QUITE 29584 54289 QUIET QUITE 31684 36481 QUIET QUITE 31684 38416 QUIET QUITE 31684 43681 QUIET QUITE 32761 72361 QUIET QUITE 34596 45369 QUIET QUITE 36481 38416 QUIET QUITE 36481 43681 QUIET QUITE 38416 43681 QUIET QUITE 41209 91204 QUIET QUITE 50176 51076 QUIET QUITE 51984 95481 QUIET QUITE 74529 79524 QUIET QUITE 78961 81796 RATE TEAR 1024 2401 RATE TEAR 1089 9801 RATE TEAR 1296 2916 RATE TEAR 1296 9216 RATE TEAR 1369 1936 RATE TEAR 1764 4761 RATE TEAR 2916 9216 RATE TEAR 4096 9604 SHOUT SOUTH 12769 96721 SHOUT SOUTH 16384 31684 SHOUT SOUTH 16384 36481 SHOUT SOUTH 16384 38416 SHOUT SOUTH 16384 43681 SHOUT SOUTH 17689 18769 SHOUT SOUTH 17689 78961 SHOUT SOUTH 17689 81796 SHOUT SOUTH 18769 78961 SHOUT SOUTH 18769 81796 SHOUT SOUTH 20736 30276 SHOUT SOUTH 21904 41209 SHOUT SOUTH 21904 91204 SHOUT SOUTH 23104 32041 SHOUT SOUTH 23409 39204 SHOUT SOUTH 23716 32761 SHOUT SOUTH 23716 72361 SHOUT SOUTH 29584 54289 SHOUT SOUTH 31684 36481 SHOUT SOUTH 31684 38416 SHOUT SOUTH 31684 43681 SHOUT SOUTH 32761 72361 SHOUT SOUTH 34596 45369 SHOUT SOUTH 36481 38416 SHOUT SOUTH 36481 43681 SHOUT SOUTH 38416 43681 SHOUT SOUTH 41209 91204 SHOUT SOUTH 50176 51076 SHOUT SOUTH 51984 95481 SHOUT SOUTH 74529 79524 SHOUT SOUTH 78961 81796 SHUT THUS 1024 2401 SHUT THUS 1089 9801 SHUT THUS 1296 2916 SHUT THUS 1296 9216 SHUT THUS 1369 1936 SHUT THUS 1764 4761 SHUT THUS 2916 9216 SHUT THUS 4096 9604 SIGN SING 1024 2401 SIGN SING 1089 9801 SIGN SING 1296 2916 SIGN SING 1296 9216 SIGN SING 1369 1936 SIGN SING 1764 4761 SIGN SING 2916 9216 SIGN SING 4096 9604 SPOT STOP 1024 2401 SPOT STOP 1089 9801 SPOT STOP 1296 2916 SPOT STOP 1296 9216 SPOT STOP 1369 1936 SPOT STOP 1764 4761 SPOT STOP 2916 9216 SPOT STOP 4096 9604 SURE USER 1024 2401 SURE USER 1089 9801 SURE USER 1296 2916 SURE USER 1296 9216 SURE USER 1369 1936 SURE USER 1764 4761 SURE USER 2916 9216 SURE USER 4096 9604 THROW WORTH 12769 96721 THROW WORTH 16384 31684 THROW WORTH 16384 36481 THROW WORTH 16384 38416 THROW WORTH 16384 43681 THROW WORTH 17689 18769 THROW WORTH 17689 78961 THROW WORTH 17689 81796 THROW WORTH 18769 78961 THROW WORTH 18769 81796 THROW WORTH 20736 30276 THROW WORTH 21904 41209 THROW WORTH 21904 91204 THROW WORTH 23104 32041 THROW WORTH 23409 39204 THROW WORTH 23716 32761 THROW WORTH 23716 72361 THROW WORTH 29584 54289 THROW WORTH 31684 36481 THROW WORTH 31684 38416 THROW WORTH 31684 43681 THROW WORTH 32761 72361 THROW WORTH 34596 45369 THROW WORTH 36481 38416 THROW WORTH 36481 43681 THROW WORTH 38416 43681 THROW WORTH 41209 91204 THROW WORTH 50176 51076 THROW WORTH 51984 95481 THROW WORTH 74529 79524 THROW WORTH 78961 81796 running time=0s289ms
上面红色的就是答案的。。。。先这样吧。
Project Euler 98:Anagramic squares 重排平方数
标签:
原文地址:http://www.cnblogs.com/theskulls/p/5026372.html