PublicServan 板


LINE

请先参考这篇 https://www.fubon.com/banking/document/news/TW/deposit_interest.pdf 每日利息之计算方式如下:1,000,000 元*0.8%*1/365 =21.9178081 元,四舍五入至小数点第五位後每日利息相当於 21.91781 元。假设计息期间首月 31 日 、次月 28 日,则该 2 个月之利息分别为: (1)21.91781*31=679.45211,四舍五入至元,即 679 元整; (2) 21.91781*28=613.69868,四舍五入至元,即 614 元整。 将code start 到 code end 放入此站 然後点网站中第一列的Run看结果 https://www.onlinegdb.com/online_c++_compiler 如图 https://www.mediafire.com/view/qd3cp0zeb081c67/fubon_continue.png/file 修改成可连算6年 可以改 i < 6 to i < 20 连算20年 但注意行规上限是70万 //code start #include <iostream> #include <stdio.h> #include <math.h> int main() { double half_interest0; double half_interest1; double accumulation = 0.0; double principal_interest = 0.0; //Round to five decimal places accumulation += round((principal_interest + 10000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 20000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 28; accumulation += round((principal_interest + 30000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 40000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + 50000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest0 = accumulation; accumulation = 0.0; accumulation += round((principal_interest + half_interest0 + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 10; //6/21 pay interest accumulation += round((principal_interest + half_interest0 + 70000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 80000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 90000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 100000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 110000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest1 = accumulation; accumulation = 0.0; accumulation += round((principal_interest+half_interest0+half_interest1+120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 11; //12/21 pay interest std::cout << "Result0: " << half_interest0 + half_interest1 << std::endl; principal_interest += 120000 + half_interest0 + half_interest1; accumulation += round((principal_interest + 10000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 20000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 28; accumulation += round((principal_interest + 30000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 40000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + 50000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest0 = accumulation; accumulation = 0.0; accumulation += round((principal_interest + half_interest0 + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 10; //6/21 pay interest accumulation += round((principal_interest + half_interest0 + 70000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 80000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 90000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 100000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 110000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest1 = accumulation; accumulation = 0.0; accumulation += round((principal_interest+half_interest0+half_interest1+120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 11; //12/21 pay interes std::cout << "Result1: " << half_interest0 + half_interest1 << std::endl; principal_interest += 120000 + half_interest0 + half_interest1 ; accumulation += round((principal_interest + 10000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 20000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 28; accumulation += round((principal_interest + 30000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 40000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + 50000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest0 = accumulation; accumulation = 0.0; accumulation += round((principal_interest + half_interest0 + 60000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 10; //6/21 pay interest accumulation += round((principal_interest + half_interest0 + 70000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 80000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 90000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 100000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 110000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 20; half_interest1 = accumulation; accumulation = 0.0; accumulation += round((principal_interest+half_interest0+half_interest1+120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 11; //12/21 pay interes std::cout << "Result2: " << half_interest0 + half_interest1 << std::endl; std::cout << std::endl; principal_interest = 0.0; accumulation = 0.0; for (int i = 0; i<5; i++) { accumulation += round((principal_interest + 10000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + 20000) * 1.595 / 100 / 365*100000.0)/100000.0 * 28; accumulation += round((principal_interest + 30000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + 40000) * 1.595 / 100 / 365*100000.0)/100000.0 * 30; accumulation += round((principal_interest + 50000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + 60000) * 1.595 / 100 / 365*100000.0)/100000.0 * 20; // half_interest0 = accumulation; accumulation = 0.0; accumulation += round((principal_interest + half_interest0 + 60000) * 1.595 / 100 / 365*100000.0)/100000.0 * 10; /*6/21 pay interest*/ accumulation += round((principal_interest + half_interest0 + 70000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 80000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 90000) * 1.595 / 100 / 365*100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 100000) * 1.595 / 100 / 365*100000.0)/100000.0 * 31; accumulation += round((principal_interest + half_interest0 + 110000) * 1.595 / 100 / 365*100000.0)/100000.0 * 30; accumulation += round((principal_interest + half_interest0 + 120000) * 1.595 / 100 / 365*100000.0)/100000.0 * 20; // half_interest1 = accumulation; accumulation = 0.0; accumulation += round((principal_interest + half_interest0 + half_interest1 + 120000) * 1.595 / 100 / 365 * 100000.0)/100000.0 * 11; /*12/21 pay interest*/ std::cout << "year total interest: " << half_interest0 + half_interest1 << std::endl; principal_interest += 120000 + half_interest0 + half_interest1; std::cout << "principal_interest: " << principal_interest << std::endl << std::endl; } getchar(); } //code end 大家再请更正 定期储蓄存款二年期 调整日期 固定 机动 2023/03/28 1.5550 1.5950 2022/12/20 1.4300 1.4700 2022/09/27 1.3050 1.3450 2022/06/21 1.1800 1.2200 2022/03/22 1.0550 1.0950 ※ 引述《fatalfeel2 (风在动)》之铭言: : 公教 定期储蓄存款 半年给息 利率1.595% : 附件为细算公式 至少问了六位行员 : 如果不说 你一定不知道Trick在那里 : 那一家的我不想说了 : 最後得知 它是单利 同时 以int(integer整数去除小数点) 来算 : 你可以心算出第一年前两个月是 0 : 无言........................... : 公教人员 你们辛苦了 : ////////////////////////////细算公式/////////////// : Result0: 858 第一年利 : Result1: 2801 第二年利 : Result2: 4760 第三年利 : 将code start 到 code end 放入此站 然後点网站中第一列的Run看结果 : https://www.onlinegdb.com/online_c++_compiler : 如图 : https://www.mediafire.com/view/yvgqp550i4017zx/bank_interest.png/file : //code start : #include <iostream> : #include <stdio.h> : int main() : { : double half_interest0; : double half_interest1; : double result = 0.0; : result += ((int)(10000 * 1.595 / 100 / 365)) * 31; : result += ((int)(20000 * 1.595 / 100 / 365)) * 28; : result += ((int)(30000 * 1.595 / 100 / 365)) * 31; : result += ((int)(40000 * 1.595 / 100 / 365)) * 30; : result += ((int)(50000 * 1.595 / 100 / 365)) * 31; : result += ((int)(60000 * 1.595 / 100 / 365)) * 20; : half_interest0 = result; : result += ((int)((60000 + half_interest0) * 1.595 / 100 / 365)) * 10; : /*6/21 pay interest*/ : result += ((int)((70000 + half_interest0) * 1.595 / 100 / 365)) * 31; : result += ((int)((80000 + half_interest0) * 1.595 / 100 / 365)) * 31; : result += ((int)((90000 + half_interest0) * 1.595 / 100 / 365)) * 30; : result += ((int)((100000 + half_interest0) * 1.595 / 100 / 365)) * 31; : result += ((int)((110000 + half_interest0) * 1.595 / 100 / 365)) * 30; : result += ((int)((120000 + half_interest0) * 1.595 / 100 / 365)) * 20; : half_interest1 = result; : result += ((int)((120000 + half_interest1) * 1.595 / 100 / 365)) * 11; : /*12/21 pay interest*/ : std::cout << "Result0: " << result << std::endl; : result = 0.0; : result += ((int)((120000 + 858 + 10000) * 1.595 / 100 / 365)) * 31; : result += ((int)((120000 + 858 + 20000) * 1.595 / 100 / 365)) * 28; : result += ((int)((120000 + 858 + 30000) * 1.595 / 100 / 365)) * 31; : result += ((int)((120000 + 858 + 40000) * 1.595 / 100 / 365)) * 30; : result += ((int)((120000 + 858 + 50000) * 1.595 / 100 / 365)) * 31; : result += ((int)((120000 + 858 + 60000) * 1.595 / 100 / 365)) * 20; : half_interest0 = result; : result += ((int)((120000 + 858 + 60000 + half_interest0) * 1.595 / 100 / : 365)) * 10; /*6/21 pay interest*/ : result += ((int)((120000 + 858 + 70000 + half_interest0) * 1.595 / 100 / : 365)) * 31; : result += ((int)((120000 + 858 + 80000 + half_interest0) * 1.595 / 100 / : 365)) * 31; : result += ((int)((120000 + 858 + 90000 + half_interest0) * 1.595 / 100 / : 365)) * 30; : result += ((int)((120000 + 858 + 100000 + half_interest0) * 1.595 / 100 / : 365)) * 31; : result += ((int)((120000 + 858 + 110000 + half_interest0) * 1.595 / 100 / : 365)) * 30; : result += ((int)((120000 + 858 + 120000 + half_interest0) * 1.595 / 100 / : 365)) * 20; : half_interest1 = result; : result += ((int)((120000 + 858 + 120000 + half_interest1) * 1.595 / 100 / : 365)) * 11; /*12/21 pay interest*/ : std::cout << "Result1: " << result << std::endl; : half_interest0 = 0.0; : result = 0.0; : result += ((int)((240000 + 858 + 2801 + 10000) * 1.595 / 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 20000) * 1.595 / 100 / 365)) * 28; : result += ((int)((240000 + 858 + 2801 + 30000) * 1.595 / 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 40000) * 1.595 / 100 / 365)) * 30; : result += ((int)((240000 + 858 + 2801 + 50000) * 1.595 / 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 60000) * 1.595 / 100 / 365)) * 20; : half_interest0 = result; : result += ((int)((240000 + 858 + 2801 + 60000 + half_interest0) * 1.595 / : 100 / 365)) * 10; /*6/21 pay interest*/ : result += ((int)((240000 + 858 + 2801 + 70000 + half_interest0) * 1.595 / : 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 80000 + half_interest0) * 1.595 / : 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 90000 + half_interest0) * 1.595 / : 100 / 365)) * 30; : result += ((int)((240000 + 858 + 2801 + 100000 + half_interest0) * 1.595 : / 100 / 365)) * 31; : result += ((int)((240000 + 858 + 2801 + 110000 + half_interest0) * 1.595 : / 100 / 365)) * 30; : result += ((int)((240000 + 858 + 2801 + 120000 + half_interest0) * 1.595 : / 100 / 365)) * 20; : half_interest1 = result; : result += ((int)((240000 + 858 + 2801 + 120000 + half_interest1) * 1.595 : / 100 / 365)) * 11; /*12/21 pay interest*/ : std::cout << "Result2: " << result << std::endl; : return 0; : } : //code end --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.32.93.159 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/PublicServan/M.1698134548.A.0E3.html ※ 编辑: fatalfeel2 (114.32.93.159 台湾), 10/25/2023 16:29:41
1F:推 qazws08: 先帮推,不过这算活存类预备金概念,比定存薛也还行 10/26 05:32







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP