±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 185  |  »Ø¸´: 1
µ±Ç°Ö÷ÌâÒѾ­´æµµ¡£
¡¾Óн±½»Á÷¡¿»ý¼«»Ø¸´±¾Ìû×Ó£¬²ÎÓë½»Á÷£¬¾ÍÓлú»á·ÖµÃ×÷Õß °×ÐÀ µÄ 20 ¸ö½ð±Ò

°×ÐÀ

Í­³æ (СÓÐÃûÆø)

[½»Á÷] ¡¾ÇóÖú¡¿Çë¸ßÊÖ°ïæ½âÌ⣡

Cryptarithmetic
Cryptarithmetic involves arithmetic on numbers where the digits have been encoded as letters.

A cryptarithmetic puzzle usually requires you to work out which digit each letter stands for. For example, if you are told that someone has to use some eye medication twice in order to see, so:
USE + USE = SEE
you have to work out that E stands for 0, S stands for 5, and U stands for 2, so the unencoded expression is:
250 + 250 = 500

In this assignment the task is simplified to repeatedly working out the result of a cryptarithmetic operation given the encoding scheme, e.g. given what the letters stand for and the following expression:
USE + USE
your program will have to unencode the encoded numbers into ints, do the arithmetic operation and encode the result, so as to work out that:
USE + USE = SEE
(Hint: Make sure that you understand the String methods, such as indexOf, before you try to work out how to unencode and encode.)

The arithmetic is to be done as integer arithmetic, e.g. 3/2 = 1, and all numbers will be such that the actual arithmetic can be done with ints, and will never involve negative numbers.

(You can look up more about cryptarithmetic on e.g. Wikipedia, but you may not use any code that you find there, or elsewhere, which relates to cryptarithmetic ¡ª not even as a starting point for your own code.)

User Interaction
The program must first explain to the user how to use it.

It must then repeatedly ask the user what they want to do next.

Whenever the user enters "Cryptarithmetic" (without quotes) after being asked what to do next, the program will:

Prompt the user to enter a one operation cryptarithmetic expression, starting with the encoding.
Read 4 Strings, using Scanner's next() method. The strings represent:
The encoding scheme, identifying the letters for digits in order from the letter for 0, e.g. "EAUBCSDFGH" (without quotes) would show that 0 is represented by E, 1 is represented by A, 2 is represented by U, ..., 5 is represented by S, ... 9 is represented by H.
The first operand, e.g. "USE" (without quotes).
The operator, e.g. "+" (without quotes).
The second operand, e.g. "USE" (without quotes).
If it was a valid cryptarithmetic encoding and expression, output (with appropriate spacing) the cryptarithmetic expression with = and result for what the user entered, e.g.:
USE + USE = SEE
Otherwise output an error message. The encoding and expression are to be considered valid, if (and only if) all the following are true:
The encoding string contains exactly 10 characters.
Every character in the encoding string is an upper case letter.
Every character in the encoding string is different from every other character in the encoding string.
Every character in the first operand is in the encoding string.
The operator string contains exactly one character.
The character in the operator string is one of the standard Java arithmetic operators: +, -, *, /, %.
Every character in the second operand is in the encoding string.

If the user enters anything other than "Cryptarithmetic" (without quotes) after being asked what to do next, the program must stop, returning from the main().

This link shows an example of user interaction of the appropriate form. (The user has indented each thing they enter so that you can see which lines they enter and which the computer has produced. This has only been done for ease of reading. Your program will be tested without such indenting.)

You must make up your own (appropriate) messages to the user, but your program must accept input of exactly the form specified, and display the cryptarithmetic results as specified. (We must be able to test your program automatically by feeding it input of the specified form and easily comparing the output produced with the expected output

Ö÷Òª¾ÍÊÇ˵E A U B C S D F G H
                  0 1 2 3 4 5 6 7 8 9
ÕâЩ¶ÔÓ¦£¬È»ºó½øÐÐÒ»¸öÑ­»·ÔËËãµÄ±à³Ì£¬ÓиßÊÖÓд𰸵ģ¬Çë°ï棬Íò·Ö¸Ðл£¡£¡£¡

[ Last edited by °×ÐÀ on 2009-9-10 at 23:01 ]
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

ÉÏÉÆÈôË®£¬ºñµÂÔØÎ
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

jjdg

°æÖ÷ (ÖªÃû×÷¼Ò)

ÓÅÐã°æÖ÷

¡ï
ÓàÔó³É(½ð±Ò+1,VIP+0):Ö§³Ö²ÎÓëÓ¦Öú£¬»¶Ó­³£À´³ÌÐòÈí¼þ°æ£¡ 10-9 12:36
ÕâÊÇÒªÇó±àÒ»¸öjava×ö¼ÓÃܵİɣ¡
USE+USE=SEEºÃÏñ²»·ûºÏEvery character in the encoding string is different from every other character in the encoding string×ÅÒ»Ìõ°¡£¡
ŬÁ¦Ñ§Ï°£¡ÒÔÕýµ±Í¾¾¶£¡»ñµÃÐèÒªµÄ֪ʶ£¡
2Â¥2009-10-09 11:58:56
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ °×ÐÀ µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] ¸÷λÀÏʦºÃ£¬ÎÒµÄһ־ԸΪ±±¾©¿Æ¼¼´óѧ085601²ÄÁÏר˶ +7 Koxui 2026-03-28 7/350 2026-03-29 00:58 by ÎÒÊÇС¿µ
[¿¼ÑÐ] Çóµ÷¼Á +7 ÕùÈ¡¾Åµã˯ 2026-03-28 8/400 2026-03-28 21:07 by ÕùÈ¡¾Åµã˯
[¿¼ÑÐ] 394Çóµ÷¼Á +3 ºÃʶàÄ¥¾²ºò¼ÑÒ 2026-03-26 5/250 2026-03-28 14:24 by ÌÆãå¶ù
[¿¼ÑÐ] 292Çóµ÷¼Á +14 ¶ì¶ì¶ì¶î¶î¶î¶î¶ 2026-03-25 15/750 2026-03-28 08:45 by WYUMater
[¿¼ÑÐ] 0703»¯Ñ§/290Çóµ÷¼Á/±¾¿Æ¾­Àú·á¸»/¹¤¿ÆÒ²¿É +9 µ¤ÇàÄÌ¸Ç 2026-03-26 10/500 2026-03-28 07:45 by barnett0632
[¿¼ÑÐ] Ò»Ö¾Ô¸211ԺУ 344·Ö ¶«±±Å©Òµ´óѧÉúÎïѧѧ˶£¬Çóµ÷¼Á +5 ؼ·çѩҹ¹éÈËØ¼ 2026-03-26 8/400 2026-03-27 19:22 by ؼ·çѩҹ¹éÈËØ¼
[¿¼ÑÐ] 266·ÖÇó²ÄÁÏ»¯¹¤Ò±½ð¿óÒµµÈרҵµÄµ÷¼Á +4 ÍÛºôºßºôºß 2026-03-26 4/200 2026-03-27 17:02 by zhyzzh
[¿¼ÑÐ] Ò»Ö¾Ô¸Ö£´ó085600£¬310·ÖÇóµ÷¼Á +5 Àîäì¿É 2026-03-26 5/250 2026-03-27 11:14 by ²»³Ôô~µÄ؈
[¿¼ÑÐ] µ÷¼ÁÍÆ¼ö +5 Ç徯714 2026-03-26 6/300 2026-03-27 11:12 by ²»³Ôô~µÄ؈
[¿¼ÑÐ] Çóµ÷¼Á£¬Ò»Ö¾Ô¸ ÄϾ©º½¿Õº½Ìì´óѧ´óѧ £¬080500²ÄÁÏ¿ÆÑ§Ó빤³Ìѧ˶ +4 @taotao 2026-03-26 5/250 2026-03-27 08:10 by hypershenger
[¿¼ÑÐ] 304²ÄÁÏÇóµ÷¼Á +4 ÖÓllll 2026-03-26 4/200 2026-03-27 03:42 by wxiongid
[¿¼ÑÐ] 325Çóµ÷¼Á +5 Àî¼Îͼ¡¤S¡¤Â· 2026-03-23 5/250 2026-03-27 00:42 by wxiongid
[¿¼ÑÐ] 351Çóµ÷¼Á +4 Âó¿Ë°¢ÀÚ 2026-03-24 4/200 2026-03-27 00:32 by wxiongid
[¿¼ÑÐ] 336²ÄÁÏÇóµ÷¼Á +7 ³ÂäÞÓ¨ 2026-03-26 9/450 2026-03-27 00:20 by wxiongid
[¿¼ÑÐ] 327Çóµ÷¼Á +7 prayer13 2026-03-23 7/350 2026-03-26 20:48 by ²»³Ôô~µÄ؈
[¿¼ÑÐ] µ÷¼Á +4 èÖèÖyoyo 2026-03-26 4/200 2026-03-26 20:43 by fmesaito
[¿¼ÑÐ] 281Çóµ÷¼Á +6 Koxui 2026-03-24 7/350 2026-03-26 15:37 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] Ò»Ö¾Ô¸ÉϺ£½»´óÉúÎïÓëҽҩר˶324·Ö£¬Çóµ÷¼Á +6 jiajunX 2026-03-22 6/300 2026-03-25 23:05 by licg0208
[¿¼ÑÐ] 289²ÄÁÏÓ뻯¹¤£¨085600£©BÇøÇóµ÷¼Á +4 ÕâôÃû×ÖÕ¦Ñù 2026-03-22 5/250 2026-03-25 08:20 by mx.yue
[¿¼ÑÐ] µ÷¼Á +4 13853210211 2026-03-24 4/200 2026-03-24 19:44 by ms629
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û