Skip to content

Instantly share code, notes, and snippets.

@tyage
Created December 19, 2010 08:01
Show Gist options
  • Save tyage/747193 to your computer and use it in GitHub Desktop.
Save tyage/747193 to your computer and use it in GitHub Desktop.
var fs = require('fs'),
sys = require('sys');
var result = function (file) {
fs.readFile(file, "utf-8", function (err, data) {
time = 0;
data = data.split('\n').forEach(function (val, i) {
time += +val
})
r = parseInt((time/60))+'\n'+(time%60)
fs.writeFile(file, r);
});
}
result('2011-yo-t1-in1.txt')
result('2011-yo-t1-in2.txt')
result('2011-yo-t1-in3.txt')
result('2011-yo-t1-in4.txt')
result('2011-yo-t1-in5.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment