Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while 1 {
- set N [expr {int(rand() * 100) + 1}]
- set S [expr {int(rand() * 10000) + 1}]
- set coins {}
- set sum 0
- for {set i 0} {$i < $N} {incr i} {
- set x [expr {int(rand() * $S) + 1}]
- lappend coins $x
- incr sum $x
- }
- if {$sum < $S} continue
- set input "$N $S\n"
- append input $coins
- set right_answer [exec {./A209} << $input]
- set crap_answer [exec {./crap} << $input]
- set equals true
- foreach c1 $right_answer c2 $crap_answer {
- if {$c1 ne $c2} {
- set equals false
- }
- }
- if $equals continue
- puts "==========\n$input\n"
- puts "Right answer:"
- puts $right_answer
- puts "\nGiven answer:"
- puts $crap_answer
- gets stdin
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement