From 217f51dd50b305b909757a82826e2b402bbd84d1 Mon Sep 17 00:00:00 2001 From: Nafis Fuad Pranta Date: Mon, 31 Jul 2023 16:45:29 +0600 Subject: [PATCH 1/3] Create en.md --- dimik-square-number/en.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 dimik-square-number/en.md diff --git a/dimik-square-number/en.md b/dimik-square-number/en.md new file mode 100644 index 00000000..870accdf --- /dev/null +++ b/dimik-square-number/en.md @@ -0,0 +1,26 @@ +# Dimik - Summation + +In this problem, you will be given `T` testcases. Each line of the testcase consists of a 5 digit integer `n`. We just have to print the summation of leftmost and rightmost digit of an integer `n`. + +### Solution +We can find the solution by square rooting the value of `n` using `sqrt` function and multiply against itself through the use of `floor` function. Because the value returned by `sqrt` function is `double` and to compare with the `integer` value of `n`, the datatype `double` is converted to `int` using `floor` function. + +### C++ +```cpp +#include +using namespace std; +int main() +{ + int t; + cin >> t; + for (int k = 1; k <= t; k++) + { + int n; + cin >> n; + if (floor(sqrt(n)) * floor(sqrt(n)) == n) + cout << "YES" << endl; + else + cout << "NO" << endl; + } +} +``` From 909e1d7af1fb7830f6712e1317f2f8624bd3fc08 Mon Sep 17 00:00:00 2001 From: Nafis Fuad Pranta Date: Mon, 31 Jul 2023 16:50:42 +0600 Subject: [PATCH 2/3] Update en.md --- dimik-square-number/en.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dimik-square-number/en.md b/dimik-square-number/en.md index 870accdf..51acd442 100644 --- a/dimik-square-number/en.md +++ b/dimik-square-number/en.md @@ -1,6 +1,6 @@ -# Dimik - Summation +# Dimik - Square Number -In this problem, you will be given `T` testcases. Each line of the testcase consists of a 5 digit integer `n`. We just have to print the summation of leftmost and rightmost digit of an integer `n`. +In this problem, you will be given `T` testcases. Each line of the testcase consists of an integer `n`. We just identify is the value of `n` is a square number or not. ### Solution We can find the solution by square rooting the value of `n` using `sqrt` function and multiply against itself through the use of `floor` function. Because the value returned by `sqrt` function is `double` and to compare with the `integer` value of `n`, the datatype `double` is converted to `int` using `floor` function. From 97a66e3b146a70514fb9a320eb45da576acd898f Mon Sep 17 00:00:00 2001 From: Nafis Fuad Pranta Date: Mon, 31 Jul 2023 16:53:17 +0600 Subject: [PATCH 3/3] Update en.md --- dimik-square-number/en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dimik-square-number/en.md b/dimik-square-number/en.md index 51acd442..6a6a0786 100644 --- a/dimik-square-number/en.md +++ b/dimik-square-number/en.md @@ -1,6 +1,6 @@ # Dimik - Square Number -In this problem, you will be given `T` testcases. Each line of the testcase consists of an integer `n`. We just identify is the value of `n` is a square number or not. +In this problem, you will be given `T` testcases. Each line of the testcase consists of an integer `n`. We just have to identify if the value of `n` is a square number or not. ### Solution We can find the solution by square rooting the value of `n` using `sqrt` function and multiply against itself through the use of `floor` function. Because the value returned by `sqrt` function is `double` and to compare with the `integer` value of `n`, the datatype `double` is converted to `int` using `floor` function.