Skip to content

Instantly share code, notes, and snippets.

@niratama
niratama / gist:2368443
Created April 12, 2012 15:44
9個中1個の重さの違う肉まんを探す(from https://twitter.com/#!/panta_rhei2004/status/190430047675486208)
#!env perl
use 5.010;
use List::Util qw(sum);
my @m = @ARGV;
if (sum(@m[0..2]) == sum(@m[3..5])) { # 0〜2と3〜5はあんまん
if ($m[6] == $m[7]){ # 6と7もあんまん
say 8;
} else { # 6か7どちらかが肉まん