問題文 弟は100以内の足し算と引き算をやりました。チャックしてあげてください。核問題の形式はa+b=c或いはa-b=c、どれも100を超えない非負整数です。cは弟が算出した回答で、200以内の比数整数であるか、一個の「?」かです。「?」は回答不能を意味します。 入力形式 入力は100行以内とし、EOF記号で終了します。一行ごとに、一問があります。形式は前述規定に則し、いかなるスペースを含みません。入力されたすべての整数に左に不要な0をつけていません。 出力形式 一行のみを出力します。一個の非負整数のみが出て、つまり、弟が正解した問題の数。 入力サンプル 1+2=33-1=56+7=?99-0=99 回答案
Author: Afante
$\frac{1}{2022}+\frac{5}{2022}+\frac{7}{2022}+…+$約分できない真分数を合計する。
約分できない真分数を加算するので、分数が分母の素因数の倍数の場合は、加算されないことになる。 2022に三つの素因数がある。2と3と337である。つまり、$U=\{1,2,3,…,2021\}$の中に、2の倍数でもなく、3の倍数でもなく、337の倍数でもない数字がどのくらいあるかを数える問題になる。式を書きやすくするために、記号を定義する。$U$の中の2の倍数の集合を$A$となる。$U$の中の3の倍数の集合を$B$となる。Uの中の337の倍数の集合を$C$となる。すると、求めたい数は$|U|-|A \cup B \cup C|$。 $$\begin{align}|A|&=\lfloor 2021 \div 2 \rfloor = 1010 \\|B|&=\lfloor 2021 \div 3 \rfloor = 673 \\|C|&=\lfloor 2021 \div 337 \rfloor = 5 \\|A \cap B|&=\lfloor 2021 \div 2 \div 3 […]
Compute Sigmoid Function Smart
The sigmoid function frequently appears in machine learning contexts. It has a simple form: $$\sigma(x)=\frac{1}{1+e^{-x}}$$. A naive implementation in C would be: It looks good, right? No, it is not. When $x << 0$, say […]
HOWTO: Eclipse 2023-12 + Cygwin + GDB 13 — A Work Around
It was said that GDB 11 or above does not work well with Eclipse with Cygwin. The true reason seems to be that Eclipse sends Windows-style path of your executable to GDB of Cygwin, while […]
Try Word Vector
Explain The Idea Word vector is widely used in text-related AI processes. Its center idea is to maximize the following likelihood function. $$\begin{equation} \label{eq:originalL}L(\theta) = \prod_{t=1}^T \prod_{\substack{-m \le j \le m \\ j \ne 0}} […]
Install React-Native for Windows on Mapped Network Drive. Very Limited Success!
React-Native claims to let people write once and run everywhere. So today, I decided to have it at my PC. And I don’t want it on my local drive, as its available space is becoming […]
Use Powershell To Collect Windows Performance Data
Powershell has many cmdlets that help users perform various tasks. In this post, I will use several commands to collect CPU and memory usage of processes. Collect Process CPU Usage Powershell has a Get-Counter cmdlet. […]
All Counters from Get-Counter in Powershell
The following command lists all counter sets. The result on my PC (Windows 10) is the following: Wish this helpful!
Start Anew
It has been a year perhaps? I lost my sites. Now it’s about time to start anew. With this simple post, I just try to get familiar with the newest WordPress functions at the time […]