浙大pat题目,js版,前端小伙伴们,算法刷起来 ##http://pat.zju.edu.cn/
tangjinzhou / pat Goto Github PK
View Code? Open in Web Editor NEW浙大pat题目,js版,前端小伙伴们,算法刷起来,http://pat.zju.edu.cn/
浙大pat题目,js版,前端小伙伴们,算法刷起来,http://pat.zju.edu.cn/
浙大pat题目,js版,前端小伙伴们,算法刷起来 ##http://pat.zju.edu.cn/
没啥好说的,刷的第一题,测试环境用
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (cmd) {
var bai = Math.floor(cmd/100);
var shi = Math.floor(cmd%100/10);
var ge = Math.floor(cmd%10);
var str = '';
for(var i = 0;i < bai; i++) {
str += 'B';
};
for (var i = 0; i < shi; i++) {
str += 'S';
};
for (var i = 0; i < ge; i++) {
str += (i + 1);
};
console.log(str);
});
var i = 1;
var grade;
require("readline")
.createInterface(process.stdin, process.stdout)
.on("line", function (str) {
if (i == 1) {
i++;
return;
}
if (i == 2) {
grade = str.split(" ").map(function (item) { return parseInt(item); });
i++;
return;
}
if (i == 3) {
var match_1 = str.split(" ").map(function (item) { return parseInt(item); }).slice(1);
var result_1 = match_1.map(function () { return 0; });
grade.forEach(function (item) {
var index = match_1.indexOf(item);
if (index != -1)
result_1[index]++;
});
console.log(result_1.join(" "));
process.exit(0);
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.