Compare commits
3 Commits
65e53afb50
...
797df26433
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
797df26433 | ||
|
|
b8dc73acf2 | ||
|
|
a849acf7cc |
33
code_study/Baekjoon/c/28702.c
Normal file
33
code_study/Baekjoon/c/28702.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
char fizzbuzz[3][9] = {"Fizz", "Buzz", "FizzBuzz"};
|
||||||
|
char s[3][9];
|
||||||
|
for(int n=0; n<3; n++) {
|
||||||
|
scanf("%s",s[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int n=0; n<3; n++) {
|
||||||
|
int isString = 0;
|
||||||
|
for(int i=0; i<3; i++) {
|
||||||
|
if(strcmp(s[n],fizzbuzz[i]) == 0) {
|
||||||
|
isString = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!isString) {
|
||||||
|
int num = atoi(s[n]) + (3-n);
|
||||||
|
if(num%15==0) printf("%s\n", fizzbuzz[2]);
|
||||||
|
else if(num%3==0) printf("%s\n", fizzbuzz[0]);
|
||||||
|
else if(num%5==0) printf("%s\n", fizzbuzz[1]);
|
||||||
|
else printf("%d\n", num);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
12
code_study/Baekjoon/js/28702.js
Normal file
12
code_study/Baekjoon/js/28702.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const s = require("fs").readFileSync(0, "utf8").toString().trim().split('\n');
|
||||||
|
let num;
|
||||||
|
let isComplet = false;
|
||||||
|
s.forEach((str, i) => {
|
||||||
|
if (!isComplet) {
|
||||||
|
if (str !== "Fizz" && str !== "Buzz" && str !== "FizzBuzz") {
|
||||||
|
num = Number(str) + (3 - i);
|
||||||
|
isComplet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log((num % 15 === 0) ? "FizzBuzz" : (num % 3 === 0) ? "Fizz" : (num % 5 === 0) ? "Buzz" : num);
|
||||||
6
code_study/Baekjoon/python/28702.py
Normal file
6
code_study/Baekjoon/python/28702.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
s = [input(), input(), input()]
|
||||||
|
for i,v in enumerate(s):
|
||||||
|
if not v in "FizzBuzz":
|
||||||
|
num = int(v) + (3-i)
|
||||||
|
print("FizzBuzz" if num%15==0 else "Fizz" if num%3==0 else "Buzz" if num%5==0 else num)
|
||||||
|
break
|
||||||
13
code_study/Baekjoon/ts/28702.ts
Normal file
13
code_study/Baekjoon/ts/28702.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const s:string[] = require("fs").readFileSync(0, "utf8").toString().trim().split('\n');
|
||||||
|
let num:number;
|
||||||
|
let isComplet:boolean = false;
|
||||||
|
s.forEach((str,i) => {
|
||||||
|
if(!isComplet) {
|
||||||
|
if(str !== "Fizz" && str !== "Buzz" && str !== "FizzBuzz") {
|
||||||
|
num = Number(str) + (3-i);
|
||||||
|
isComplet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log((num%15===0) ? "FizzBuzz" : (num%3===0) ? "Fizz" : (num%5===0) ? "Buzz" : num);
|
||||||
6
mySettingFile/tsconfig.json
Normal file
6
mySettingFile/tsconfig.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user