📄 grocery.pl
字号:
/*
A kid goes into a grocery store and buys four items. The cashier charges $7.11.
The kid pays and is about to leave when the cashier calls the kid back, and says
"Hold on, I multiplied the four items instead of adding them; I'll try again...
Gosh, with adding them the price still comes to $7.11"! What were the prices of
the four items?
*/
go:-
cputime(X),
Vars=[A,B,C,D],
Vars in 1..711,
A+B+C+D #= 711,
A*B #= T1,
C*D #= T2,
T1*T2 #= 711*100*100*100,
labeling(Vars),
cputime(Y),
T is Y-X,
write(Vars), write(' found in '), write(T), write(' milliseconds'),nl.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -