| 5 | 1/1 | 返回列表 |
| 查看: 482 | 回復: 2 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
[交流]
【求助】為什么兩種寫法得到的值不一樣?
|
|||
|
為什么把if語句放到不同的位置,結(jié)果就不一樣了呢?請大家?guī)兔Ψ治鲆幌,多謝。 寫法一(判斷語句為h0(t)/=0): t0=0 do ntel=1, npoints neworig = .false. if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(h0(t)/=0.and.(delt.lt.npoints)) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo 寫法二(判斷語句為if (h(ntel)/=0) then) t0=0 do ntel=1, npoints neworig = .false. if (h(ntel)/=0) then if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(delt.lt.npoints) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo |
» 搶金幣啦!回帖就可以得到:
+1/284
+1/89
+1/87
+1/84
+2/52
+1/42
+1/17
+1/17
+1/17
+1/10
+1/9
+1/8
+1/8
+1/8
+1/7
+1/6
+1/4
+1/2
+1/2
+1/1
至尊木蟲 (職業(yè)作家)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料調(diào)劑 +8 | 一樣YWY 2026-04-02 | 8/400 |
|
|---|---|---|---|---|
|
[考研] 311求調(diào)劑 +14 | 藍月亮亮 2026-03-30 | 14/700 |
|
|
[考研] 271求調(diào)劑 +15 | 勒布朗@ 2026-03-31 | 20/1000 |
|
|
[考研] 266分,一志愿電氣工程,本科材料,求材料專業(yè)調(diào)劑 +3 | 哇呼哼呼哼 2026-04-02 | 3/150 |
|
|
[考研] 求調(diào)劑,一志愿 南京航空航天大學 ,080500材料科學與工程學碩,總分289分 +11 | @taotao 2026-03-29 | 11/550 |
|
|
[考研] 367求調(diào)劑 +8 | 芋泥啵! 2026-03-28 | 8/400 |
|
|
[考研] 086502化學工程342求調(diào)劑 +7 | 阿姨復古不過 2026-03-27 | 7/350 |
|
|
[考研] 求調(diào)劑 +4 | 圖鑒212 2026-03-30 | 5/250 |
|
|
[考研] 08工科,295,接受跨專業(yè)調(diào)劑 +6 | lmnlzy 2026-03-31 | 6/300 |
|
|
[考研] 求0861交通運輸專碩or材料專碩調(diào)劑 +4 | 勒布朗@ 2026-03-31 | 4/200 |
|
|
[考研] 346求調(diào)劑 一志愿070303有機化學 +11 | 蘿卜燉青菜 2026-03-28 | 12/600 |
|
|
[考研] 本科211生物醫(yī)學工程085409求調(diào)劑339分 +7 | 里子木yy 2026-03-29 | 7/350 |
|
|
[考研] 081200-11408-276學碩求調(diào)劑 +4 | 崔wj 2026-03-31 | 4/200 |
|
|
[考研]
|
Gymno 2026-03-30 | 6/300 |
|
|
[考研] 本科211總分289,08工學真心求調(diào)劑 +3 | utopiaE 2026-03-30 | 3/150 |
|
|
[有機交流] 考研調(diào)劑 +8 | watb 2026-03-26 | 8/400 |
|
|
[考研] 303求調(diào)劑 +7 | DLkz1314. 2026-03-30 | 7/350 |
|
|
[考研] 283求調(diào)劑(080500) +14 | A child 2026-03-27 | 14/700 |
|
|
[考研] 296求調(diào)劑 +10 | 彼岸t 2026-03-29 | 10/500 |
|
|
[考研] 298調(diào)劑 +3 | jiyingjie123 2026-03-27 | 3/150 |
|