summaryrefslogtreecommitdiff
path: root/PlaygroundCpp
diff options
context:
space:
mode:
Diffstat (limited to 'PlaygroundCpp')
-rw-r--r--PlaygroundCpp/.cproject6
-rw-r--r--PlaygroundCpp/.settings/language.settings.xml4
-rw-r--r--PlaygroundCpp/Sources/Playground.cpp31
3 files changed, 17 insertions, 24 deletions
diff --git a/PlaygroundCpp/.cproject b/PlaygroundCpp/.cproject
index 6299ddd..83e6d3d 100644
--- a/PlaygroundCpp/.cproject
+++ b/PlaygroundCpp/.cproject
@@ -65,13 +65,13 @@
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1593738472" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
- <option id="gnu.cpp.link.option.paths.1593365739" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <option id="gnu.cpp.link.option.paths.1593365739" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="/home/haidong/googletest/build/googlemock/gtest"/>
</option>
- <option id="gnu.cpp.link.option.libs.2046973616" superClass="gnu.cpp.link.option.libs" valueType="libs">
+ <option id="gnu.cpp.link.option.libs.2046973616" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="gtest"/>
@@ -91,7 +91,7 @@
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.183585801" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
- <option id="gnu.both.asm.option.include.paths.1592126793" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <option id="gnu.both.asm.option.include.paths.1592126793" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/home/haidong/googletest/googletest/include"/>
diff --git a/PlaygroundCpp/.settings/language.settings.xml b/PlaygroundCpp/.settings/language.settings.xml
index 54c9fee..bbdba31 100644
--- a/PlaygroundCpp/.settings/language.settings.xml
+++ b/PlaygroundCpp/.settings/language.settings.xml
@@ -11,7 +11,7 @@
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939556362312027581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939399062786427581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
@@ -33,7 +33,7 @@
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939556362312027581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939399062786427581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
diff --git a/PlaygroundCpp/Sources/Playground.cpp b/PlaygroundCpp/Sources/Playground.cpp
index caa008b..2986140 100644
--- a/PlaygroundCpp/Sources/Playground.cpp
+++ b/PlaygroundCpp/Sources/Playground.cpp
@@ -12,34 +12,27 @@ static int getGCD(int a, int b) {
return getGCD(b, a % b);
}
}
-//TEST(FibLastDigitTest, Zero) {
-// ASSERT_EQ(getGCD(18, 35), 1);
-//}
-//
-//TEST(FibLastDigitTest, One) {
-// ASSERT_EQ(17657, getGCD(28851538, 1183019));
-//}
-//
-//TEST(FibLastDigitTest, Three) {
-// ASSERT_EQ(7, getGCD(1344, 217));
-//}
-//
-//TEST(FibLastDigitTest, Forty) {
-// ASSERT_EQ(1344, getGCD(1344, 1344));
+static long getLCM(int a, int b) {
+ // https://www.idomaths.com/hcflcm.php#formula
+ return (long) a * (long) b / (long) getGCD(a, b);
+}
+
+//TEST(LCMTest, Zero) {
+// ASSERT_EQ(getLCM(6, 8), 24);
//}
//
-//TEST(FibLastDigitTest, ThreeThreeOne) {
-// ASSERT_EQ(4, getGCD(14159572, 63967072));
+//TEST(LCMTest, One) {
+// ASSERT_EQ(getLCM(28851538, 1183019), 1933053046);
//}
//
-//TEST(FibLastDigitTest, ReverseAB) {
-// ASSERT_EQ(4, getGCD(14159572, 63967072));
+//TEST(LCMTest, Two) {
+// ASSERT_EQ(getLCM(14159572, 63967072), 226436590403296);
//}
int main() {
int a, b;
std::cin >> a;
std::cin >> b;
- int c = getGCD(a, b);
+ long c = getLCM(a, b);
std::cout << c << '\n';
}