討論:希頂解經

出自希顶维基
由ColorfulGalaxy在話題Open source program上作出的最新留言:週一在 20:00

Open source program

This program takes Chat Alphabet letters as input. ColorfulGalaxy留言2024年12月16日 (一) 20:00 (CST)回覆

#include <cstdio>
#define lnt long long
const char format[]="%lld";
unsigned char c;
lnt sum;
const lnt nums[256]={
00000,00000,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000,
00000,00000,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000,
00000,00+00,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000, 00000,00000,00000,00000,
00000,80000,30000,60000, 0+400,0+500,20000,0+800, 50000,00000,00000,00000,
00000,00000,00000,00000,
00000,+8000,0+900,00000, 00+20,+7000,0+700,00000, 00+50,00000,00000,00000, 10000,00000,00+60,00000,
00000,00000,00000,00000, 40000,00000,70000,00000, 00000,+9000,00000,00000, 00000,00000,00000,00000,
00000,+4000,00001,+1000, 00+80,+6000,+2000,0+100, 0+300,90000,00005,0+200, 00+70,00003,000+9,+5000,
00002,00006,00+40,00+30, 00+90,+3000,0+600,00004, 00007,000+8,00+10};
int main(){
while((c=getchar())-255){
sum+=nums[c];
sum<0 && fputs("Number overflow",stderr);
}
printf(format,sum);
return 0;
}