ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題
- Dec 03 Sun 2023 23:49
ZEROJUDGE C++程式解題2
- Dec 03 Sun 2023 23:49
ZEROJUDGE C++程式解題1
ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題ZEROJUDGE C++程式解題
- Dec 03 Sun 2023 11:58
ZEROJUDGE C++程式解題 a038
此題為出自zerojidge 基礎題a038 數字翻轉
以下是我寫出來的答案
(一)沒有struct版本
#include
using namespace std;
int reverseNumber(int num);
int main()
{
int num;
cin >> num;
int reversedNum;
reversedNum=reverseNumber(num);
cout << reversedNum << endl;
return 0;
}
int reverseNumber(int num)
{
// 當數字為 0 時直接輸出 0
if (num == 0)
{
cout << num << endl;
return 0;
}
// 反轉數字同時忽略尾部的零
int reversedNum = 0;
while (num > 0)
{
int digit = num % 10; // 獲取最後一位數
num /= 10; // 移除最後一位數
if (digit == 0 && reversedNum == 0)
{
// 忽略尾部的零
continue;
}
reversedNum = reversedNum * 10 + digit; // 將數字反轉
}
return reversedNum;
}
點我看程式碼
(二)有struct版本
- Dec 02 Sat 2023 23:27
ZEROJUDGE C++程式解題 a024
此題為出自zerojidge 基礎題a024
以下是我寫出來的答案
(一)沒有class版本
#include <iostream>
using namespace std;
// 函數:計算最大公因數
int gcd(int num1, int num2);
int main()
{
int num1, num2;
cin >> num1 >> num2;
cout << gcd(num1, num2) << endl;
return 0;
}
// 實現 gcd 函數
int gcd(int num1, int num2)
{
while (num2 != 0)
{
int temp = num2;
num2 = num1 % num2;
num1 = temp;
}
return a; // 返回計算結果
}
點我看程式碼
(二)有class版本
- Dec 02 Sat 2023 22:59
ZEROJUDGE C++程式解題 a022
此題為出自zerojidge 基礎題a022
以下是我寫出來的答案
#include <iostream>
using namespace std;
// 定義 isPalindrome 函數
void isPalindrome(string word) ;
int main()
{
string word;
cin >> word; // 正確讀取字串
isPalindrome(word); // 調用 isPalindrome 函數
return 0;
}
void isPalindrome(string word)
{
int length = word.length();
bool isPalin = true;
for (int i = 0; i < length / 2; i++)
{
if (word[i] != word[length - 1 - i])
{
isPalin = false; // 若找到不匹配的字符,則非迴文
break;
}
}
if (isPalin)
{
cout << "yes";
}
else
{
cout << "no";
}
}
點我看程式碼
- Dec 02 Sat 2023 22:35
ZEROJUDGE C++程式解題 a015
此題為出自zerojidge 基礎題a015
以下是我寫出來的答案
#include <iostream>
using namespace std;
int main()
{
int row, column;
// 當還有輸入時持續處理
while (cin >> row >> column)
{
// 動態分配二維陣列
int** matrix = new int*[row];
for (int i = 0; i < row; i++)
{
matrix[i] = new int[column];
}
// 從輸入讀取矩陣元素
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
cin >> matrix[i][j];
}
}
// 轉置矩陣
for (int i = 0; i < column; i++) {
for (int j = 0; j < row; j++) {
cout << matrix[j][i] << " ";
}
cout << endl;
}
delete[] matrix;
matrix=nullptr;
}
return 0;
}
點我看程式碼
- Nov 27 Mon 2023 22:53
ZEROJUDGE題目解析整理
- Nov 27 Mon 2023 22:50
ZEROJUDGE基本題庫
- Nov 26 Sun 2023 15:06
leetcode 1768. Merge Strings Alternately
點我看題目
class Solution
{
public:
string mergeAlternately(string word1, string word2)
{
string result="";
int length1 = word1.length(), length2 = word2.length();
int minLength = min(length1, length2);
// 使用 for 循环交替添加字符
for (int i = 0; i < minLength; i++)
{
result += word1[i];
result += word2[i];
}
// 添加剩余的字符
for (int i = minLength; i < length1; i++)
{
result += word1[i];
}
for (int i = minLength; i < length2; i++)
{
result += word2[i];
}
return result;
}
};
- Nov 25 Sat 2023 16:57
C++程式解題005
此題為出自zerojidge 基礎題005
以下是我寫出來的答案
#include <iostream>
using namespace std;
int main()
{
//先確認會有幾個數列
int n;
cin >> n;
//依次輸入每個數列的四個數字
for (int i = 0; i < n; i++)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
// 判斷數列類型
if (b - a == c - b && c - b == d - c)
{
// 等差數列
int diff = b - a;
cout << a << " " << b << " " << c << " " << d << " " << d + diff << endl;
}
else if (b / a == c / b && c / b == d / c)
{
// 等比數列
int ratio = b / a;
cout << a << " " << b << " " << c << " " << d << " " << d * ratio << endl;
}
}
return 0;
}
- Nov 25 Sat 2023 16:20
C++程式解題004
- Nov 24 Fri 2023 23:47
台大WEBWORK 微積分1:11~14組 【7.5: Problem 1~Problem 4】
- Nov 24 Fri 2023 23:46
台大WEBWORK 微積分1:11~14組 【7.4: Problem 1~Problem 6】
- Nov 24 Fri 2023 23:45
台大WEBWORK 微積分1:11~14組 【7.3: Problem 1~Problem 5】
PROBLEM 01
(1 point) Evaluate the integral using the indicated trigonometric substitution. ∫10x39−x2−−−−−√dx,x=3sin(θ)
|
- Oct 30 Mon 2023 00:46
台大WEBWORK 微積分1:11~14組 【4.9: Problem 1~Problem 3】
PROBLEM 01
( 1 point) Find the most general antiderivative of f(x)=7x3−−√4−8x4−−√3. Note: Any arbitrary constants used must be an upper-case "C". |
- Oct 25 Wed 2023 23:56
Michael同學的家教紀錄【試教】
以下為試教內容
- Oct 25 Wed 2023 23:55
麥可同學的家教紀錄
以下是家教紀錄總整理
- Oct 25 Wed 2023 19:33
台大WEBWORK 微積分1:11~14組 【4.4: Problem 1~Problem 7】
PROBLEM 01
(1 point) Given that limx→af(x)=0, limx→ag(x)=0, limx→ah(x)=1, limx→ap(x)=∞, limx→aq(x)=∞. Which of the following limits are indeterminate forms? For those that are not an indeterminate form, evaluate the limit where possible. Enter I to indicate an indeterminate form, INF for positive infinity, NINF for negative infinity, and D for the limit does not exist or we don't have enough information to determine the limit. (a) limx→a[f(x)]g(x)= |
- Oct 09 Mon 2023 17:43
台大WEBWORK 微積分1:11~14組 【3.6: Problem 1~Problem 8】
- Oct 05 Thu 2023 23:44
台大WEBWORK 微積分1:11~14組 【3.4: Problem 1~Problem 6】