日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Turing equation

發布時間:2023/12/20 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Turing equation 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

問題 F: F.Turing equation

時間限制:?1 Sec??內存限制:?128 MB
提交:?19??解決:?1
[提交][狀態][討論版]

題目描述

The fight goes on,whether to store?numbers starting with their most significant digit ortheir least?significant digit. Sometimes?this?is alsocalled?the?"Endian War". The battleground?dates farback into the early days of computer?science. Joe Stoy,?in his (bythe way excellent)?book?"Denotational Semantics", tellsfollowing story:

"Thedecision?which way round the digits run is,?of course, mathematicallytrivial. Indeed,?one early British computer?had numbers running fromright to left (because the?spot on an oscilloscope tube?runs fromleft to right, but?in serial logic the least significant digits are dealtwith first). Turing used to mystify audiences at public lectures when, quite byaccident, he would slip into this mode even for decimal arithmetic, andwrite?things?like 73+42=16.?The next version of?the machinewas?made?more conventional simply?by crossing the x-deflectionwires:?this,?however, worried the engineers, whosewaveforms?were all backwards. That problem was in turn solved by providinga little window so that the engineers (who tended to be behind the computeranyway) could view the oscilloscope screen from the back.

?

You will play therole of the audience and judge on the truth value of Turing's equations.

輸入

he input containsseveral test cases. Each specifies on a single line a Turing equation. A Turingequation has the form "a+b=c", where a, b, c are numbers made up ofthe digits 0,...,9. Each number will consist of at most 7 digits. This includespossible leading or trailing zeros. The equation "0+0=0" will finishthe input and has to be processed, too. The equations will not contain anyspaces.

輸出

For each test casegenerate a line containing the word "TRUE" or the word"FALSE", if the equation is true or false, respectively, in Turing'sinterpretation, i.e. the numbers being read backwards.

樣例輸入

73+42=16

5+8=13

0001000+000200=00030

0+0=0

樣例輸出

TRUE

FALSE

TRUE

cpp:

#include<stdio.h> #include<string.h> int main(void) { char str[110]; while(gets(str)) { int num1=0,num2=0,num3=0; int i,j,k; int len1=strlen(str)-1; for(i=len1;i>=0;i--) { if(str[i]=='=') j=i; if(str[i]=='+') k=i; } for(i=len1;i>j;i--) { num3=num3*10+(str[i]-48); } for(i=j-1;i>k;i--) { num2=num2*10+(str[i]-48); } for(i=k-1;i>=0;i--) { num1=num1*10+(str[i]-48); } if(num1==0&&num2==0&&num3==0) break; else if(num1+num2==num3) { printf("TRUE\n"); } else { printf("FALSE\n"); } } return 0; }

總結

以上是生活随笔為你收集整理的Turing equation的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。