黑色數學118關
先直接報答案 x=4 y=13
x和y是兩個整數,且滿足2<=x<=y<=99
甲知道兩個數的和,乙知道兩個數的積。
一、甲:你不知道這兩個數是什麼,我也不知道。
二、乙:我現在知道了。
三、甲:我現在也知道了。
那麼x和y分別是多少?
**先放這 有空再寫注釋
主要思路就是,乙的數不能有唯一因式分解方法(如9=33,或者9801=9999),慢慢往前推
```python
set1=set()
for i in range(4,9802):
count1=0
for j in range(2,int(i**0.5)+1):
if i%j==0 and i/j<100:
count1+=1
ans=j
if count1==1:
set1.add(int(i/ans)+ans)
dict1={}
for i in range(4,9802):
count1=0
count2=0
for j in range(2,int(i**0.5)+1):
if i%j==0 and i/j<100 and int(i/j)+j not in set1:
count1+=1
ans=j
elif i%j==0 and i/j<100 and int(i/j)+j in set1:
count2+=1
if count1==1 and count2>0:
if int(i/ans)+ans not in dict1:
dict1[int(i/ans)+ans]=true
else:
dict1[int(i/ans)+ans]=false
for keys in dict1:
if dict1[keys]==true:
print(keys)
11 8 刪除結點
刪除結點 輸入若干個正整數 輸入 1為結束標誌 建立乙個單向鍊錶,再輸入乙個整數m,刪除鍊錶中值為m的所有結點。試編寫相應程式。鍊錶結點定義 struct listnode 函式介面定義 struct listnode readlist struct listnode deletem struct ...
118 合併區間
題目描述 給出乙個區間的集合,請合併所有重疊的區間。示例 1 輸入 1,3 2,6 8,10 15,18 輸出 1,6 8,10 15,18 解釋 區間 1,3 和 2,6 重疊,將它們合併為 1,6 示例 2 輸入 1,4 4,5 輸出 1,5 解釋 區間 1,4 和 4,5 可被視為重疊區間。c...
11 8 學習記錄
下拉列表彈出方向預設為向下,當然我們也可以設定不同的方向。如果你希望下拉列表向右下方彈出,可以在 div 元素上新增 dropdown menu end 類 下拉列表右下方彈出 button 鏈結 1a li 鏈結 2a li 鏈結 3a li ul div 嘗試一下 如果你希望上拉選單向上彈出,可...