#39263: to_string


1120188@ccjh.cyc.edu.tw (708-20詹以恩)

學校 : 不指定學校
編號 : 252192
來源 : [163.27.118.65]
最後登入時間 :
2024-04-27 12:10:57
d238. "<<"運算子真好用 -- Project Euler | From: [218.164.226.186] | 發表日期 : 2024-01-29 18:15

string s=to_string(pow(2,1000)); //將2^1000轉換為字串

int sum=0;

for(auto c:s){ //讀取s中的字元

(c!='.')&&(sum+=c-48) // '0'=48(ASCII) 

}

 

 
ZeroJudge Forum