b117: 絕對值 & 減一
標籤 : 12th初階班下學期期末考
通過比率 : 16人/16人 ( 100% ) [非即時]
評分方式:
Tolerant

最近更新 : 2024-04-25 15:31

內容

$\color{#333333}{f(x)=\underbrace{|||||x|-1|-1|\cdots|-1|}_\text{共a個(-1)}}$

給定$\color{#333333}{a}$,問$\color{#333333}{\sum\limits_{k=0}^a f(k)}$,即$\color{#333333}{f(0)+f(1)+f(2)+\cdots+f(a)}$

輸入說明

第一行有一正整數$\color{#333333}{T}$

接下來$\color{#333333}{T}$行每行有一正整數$\color{#333333}{a}$

輸出說明

對於每一行$\color{#333333}{a}$輸出所求

輸出之間請換行

範例輸入
1
2
範例輸出
1
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (10%): 1.0s , <1K
公開 測資點#1 (10%): 1.0s , <1K
公開 測資點#2 (10%): 1.0s , <1K
公開 測資點#3 (10%): 1.0s , <1M
公開 測資點#4 (10%): 1.0s , <1M
公開 測資點#5 (10%): 1.0s , <1M
公開 測資點#6 (10%): 1.0s , <1M
公開 測資點#7 (10%): 1.0s , <1M
公開 測資點#8 (10%): 1.0s , <1M
公開 測資點#9 (10%): 1.0s , <1M
提示 :

範測:$\color{#333333}{f(0)=0,\ f(1)=1,\ f(2)=0}$

 

$\color{#333333}{\bullet\ 40\%:T\le 800,\ a\le 100}$

$\color{#333333}{\forall\ 1\le T\le 50000,\ a>0,\ a\in \text{int}}$

標籤:
12th初階班下學期期末考
出處:
[管理者:
aaaron08813 (12th 副初階教學/柏霖)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」