8th_B

[b]B. 嘉娃的难题[/b]
[b]问题描述[/b]
嘉娃的家庭作业里有很多数列填空练习题。填空练习题的要求是:已知数列的前四
项,填出第五项。因为已经知道这些数列只可能是等差或者等比数列,所以他决定写一
个程序来完成这些练习。
[b]输入格式[/b]
第一行是数列的数目 T (0 ≤ T ≤ 40)。接下来 T 行每行均包含四个整数,表示一个
数列的前四项。数列的前五项均为绝对值不大于 109 的自然数,等比数列的比值也是自
然数。
[b]输出格式[/b]
对输入的每个数列,输出它的前五项,每一行的末尾没有多余空格。
[b]样例输入[/b]
2
-1 -2 -3 -4
1 2 4 8
[b]样例输出[/b]
-1 -2 -3 -4 -5
1 2 4 8 16

#include<cstdio>

int main(){
int i,j;
int n;
double a[5];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<5;j++){
a[j]=0;
}
for(j=0;j<4;j++){
scanf("%lf",&(a[j]));
}
if((a[3]+a[1]==2*a[2])&&(a[2]+a[0]==2*a[1])){
a[4]=a[3]*2-a[2];
}else if((a[3]*a[1]==a[2]*a[2])&&(a[2]*a[0]==a[1]*a[1])){
a[4]=a[3]*a[3]/a[2];
}
for(j=0;j<4;j++){
printf("%d ",(int)a[j]);
}
printf("%d\n",(int)a[4]);
}
return 0;
}

你现在帮我计算fpd1_lift 区分首复贷和产品 就是分子:区间逾期的样本/区间所有样本 分母:所有逾期样本/总样本 分十个箱 表名为dws.dws_acct_triangle_df 表的内容有:contr_no apply_no apply_date 1st_loan_date 1st_wdraw_date 1st_consume_date loan_tot_amt wdraw_tot_amt consume_tot_amt spl_tot_prin spl_tot_debt dpd max_dpd 1st_repayable_date 1st_cleared_date 1st_dpd 2nd_repayable_date 2nd_cleared_date 2nd_dpd 3rd_repayable_date 3rd_cleared_date 3rd_dpd 4th_repayable_date 4th_cleared_date 4th_dpd 5th_repayable_date 5th_cleared_date 5th_dpd 6th_repayable_date 6th_cleared_date 6th_dpd 7th_repayable_date 7th_cleared_date 7th_dpd 8th_repayable_date 8th_cleared_date 8th_dpd 9th_repayable_date 9th_cleared_date 9th_dpd 10th_repayable_date 10th_cleared_date 10th_dpd 11th_repayable_date 11th_cleared_date 11th_dpd 12th_repayable_date 12th_cleared_date 12th_dpd 13th_repayable_date 13th_cleared_date 13th_dpd 14th_repayable_date 14th_cleared_date 14th_dpd 15th_repayable_date 15th_cleared_date 15th_dpd 16th_repayable_date 16th_cleared_date 16th_dpd 17th_repayable_date 17th_cleared_date 17th_dpd 18th_repayable_date 18th_cleared_date 18th_dpd 19th_repayable_date 19th_cleared_date 19th_dpd 20th_repayable_date 20th_cleared_date 20th_dpd 21th_repayable_date 21th_cleared_date 21th_dpd 22th_repayable_date 22th_cleared_date 22th_dpd 23th_repayable_date 23th_cleared_date 23th_dpd 24th_repayable_date 24th_cleared_date 24th_dpd lately_24th_repayable_date lately_24th_cleared_date lately_24th_dpd lately_23th_repayable_date lately_23th_cleared_date lately_23th_dpd lately_22th_repayable_date lately_22th_cleared_date lately_22th_dpd lately_21th_repayable_date lately_21th_cleared_date lately_21th_dpd lately_20th_repayable_date lately_20th_cleared_date lately_20th_dpd lately_19th_repayable_date lately_19th_cleared_date lately_19th_dpd lately_18th_repayable_date lately_18th_cleared_date lately_18th_dpd lately_17th_repayable_date lately_17th_cleared_date lately_17th_dpd lately_16th_repayable_date lately_16th_cleared_date lately_16th_dpd lately_15th_repayable_date lately_15th_cleared_date lately_15th_dpd lately_14th_repayable_date lately_14th_cleared_date lately_14th_dpd lately_13th_repayable_date lately_13th_cleared_date lately_13th_dpd lately_12th_repayable_date lately_12th_cleared_date lately_12th_dpd lately_11th_repayable_date lately_11th_cleared_date lately_11th_dpd lately_10th_repayable_date lately_10th_cleared_date lately_10th_dpd lately_9th_repayable_date lately_9th_cleared_date lately_9th_dpd lately_8th_repayable_date lately_8th_cleared_date lately_8th_dpd lately_7th_repayable_date lately_7th_cleared_date lately_7th_dpd lately_6th_repayable_date lately_6th_cleared_date lately_6th_dpd lately_5th_repayable_date lately_5th_cleared_date lately_5th_dpd lately_4th_repayable_date lately_4th_cleared_date lately_4th_dpd lately_3rd_repayable_date lately_3rd_cleared_date lately_3rd_dpd lately_2nd_repayable_date lately_2nd_cleared_date lately_2nd_dpd lately_1st_repayable_date lately_1st_cleared_date lately_1st_dpd etl_time etl_source unique_id master_contr_no master_child_contr_flag prod_cd ovd_begin_date cpd_begin_date repayable_prin repay_match_prin_amt ovd_prin dt
08-07
你现在帮我计算fpd1_lift 区分首复贷和产品 计算fpd1的时候要这样计算: SELECT prod_cd, COUNT(DISTINCT contr_no) AS total_loans, SUM(CASE WHEN 1st_dpd >= 1 THEN 1 ELSE 0 END) AS fpd1_count, SUM(CASE WHEN 1st_dpd >= 7 THEN 1 ELSE 0 END) AS fpd7_count, SUM(CASE WHEN 1st_dpd >= 15 THEN 1 ELSE 0 END) AS fpd15_count, SUM(CASE WHEN 1st_dpd >= 30 THEN 1 ELSE 0 END) AS fpd30_count, ROUND(SUM(CASE WHEN 1st_dpd >= 1 THEN 1 ELSE 0 END) / COUNT(DISTINCT contr_no), 4) AS fpd1, ROUND(SUM(CASE WHEN 1st_dpd >= 7 THEN 1 ELSE 0 END) / COUNT(DISTINCT contr_no), 4) AS fpd7, ROUND(SUM(CASE WHEN 1st_dpd >= 15 THEN 1 ELSE 0 END) / COUNT(DISTINCT contr_no), 4) AS fpd15, ROUND(SUM(CASE WHEN 1st_dpd >= 30 THEN 1 ELSE 0 END) / COUNT(DISTINCT contr_no), 4) AS fpd30 FROM dws.dws_acct_triangle_df WHERE dt = '20250802' AND DATEDIFF(TO_DATE(dt, 'yyyyMMdd'), 1st_loan_date) >= 1 AND ( (1st_dpd >= 1 AND DATEDIFF(TO_DATE(dt, 'yyyyMMdd'), 1st_loan_date) >= 1) OR (1st_dpd >= 7 AND DATEDIFF(TO_DATE(dt, 'yyyyMMdd'), 1st_loan_date) >= 7) OR (1st_dpd >= 15 AND DATEDIFF(TO_DATE(dt, 'yyyyMMdd'), 1st_loan_date) >= 15) OR (1st_dpd >= 30 AND DATEDIFF(TO_DATE(dt, 'yyyyMMdd'), 1st_loan_date) >= 30) OR 1st_dpd IS NULL OR 1st_dpd = 0 ) GROUP BY prod_cd; 最终计算fpd1lift的计算方法:分子:区间逾期的样本/区间所有样本 分母:所有逾期样本/总样本 分十个箱 表名为dws.dws_acct_triangle_df 表的内容有:contr_no apply_no apply_date 1st_loan_date 1st_wdraw_date 1st_consume_date loan_tot_amt wdraw_tot_amt consume_tot_amt spl_tot_prin spl_tot_debt dpd max_dpd 1st_repayable_date 1st_cleared_date 1st_dpd 2nd_repayable_date 2nd_cleared_date 2nd_dpd 3rd_repayable_date 3rd_cleared_date 3rd_dpd 4th_repayable_date 4th_cleared_date 4th_dpd 5th_repayable_date 5th_cleared_date 5th_dpd 6th_repayable_date 6th_cleared_date 6th_dpd 7th_repayable_date 7th_cleared_date 7th_dpd 8th_repayable_date 8th_cleared_date 8th_dpd 9th_repayable_date 9th_cleared_date 9th_dpd 10th_repayable_date 10th_cleared_date 10th_dpd 11th_repayable_date 11th_cleared_date 11th_dpd 12th_repayable_date 12th_cleared_date 12th_dpd 13th_repayable_date 13th_cleared_date 13th_dpd 14th_repayable_date 14th_cleared_date 14th_dpd 15th_repayable_date 15th_cleared_date 15th_dpd 16th_repayable_date 16th_cleared_date 16th_dpd 17th_repayable_date 17th_cleared_date 17th_dpd 18th_repayable_date 18th_cleared_date 18th_dpd 19th_repayable_date 19th_cleared_date 19th_dpd 20th_repayable_date 20th_cleared_date 20th_dpd 21th_repayable_date 21th_cleared_date 21th_dpd 22th_repayable_date 22th_cleared_date 22th_dpd 23th_repayable_date 23th_cleared_date 23th_dpd 24th_repayable_date 24th_cleared_date 24th_dpd lately_24th_repayable_date lately_24th_cleared_date lately_24th_dpd lately_23th_repayable_date lately_23th_cleared_date lately_23th_dpd lately_22th_repayable_date lately_22th_cleared_date lately_22th_dpd lately_21th_repayable_date lately_21th_cleared_date lately_21th_dpd lately_20th_repayable_date lately_20th_cleared_date lately_20th_dpd lately_19th_repayable_date lately_19th_cleared_date lately_19th_dpd lately_18th_repayable_date lately_18th_cleared_date lately_18th_dpd lately_17th_repayable_date lately_17th_cleared_date lately_17th_dpd lately_16th_repayable_date lately_16th_cleared_date lately_16th_dpd lately_15th_repayable_date lately_15th_cleared_date lately_15th_dpd lately_14th_repayable_date lately_14th_cleared_date lately_14th_dpd lately_13th_repayable_date lately_13th_cleared_date lately_13th_dpd lately_12th_repayable_date lately_12th_cleared_date lately_12th_dpd lately_11th_repayable_date lately_11th_cleared_date lately_11th_dpd lately_10th_repayable_date lately_10th_cleared_date lately_10th_dpd lately_9th_repayable_date lately_9th_cleared_date lately_9th_dpd lately_8th_repayable_date lately_8th_cleared_date lately_8th_dpd lately_7th_repayable_date lately_7th_cleared_date lately_7th_dpd lately_6th_repayable_date lately_6th_cleared_date lately_6th_dpd lately_5th_repayable_date lately_5th_cleared_date lately_5th_dpd lately_4th_repayable_date lately_4th_cleared_date lately_4th_dpd lately_3rd_repayable_date lately_3rd_cleared_date lately_3rd_dpd lately_2nd_repayable_date lately_2nd_cleared_date lately_2nd_dpd lately_1st_repayable_date lately_1st_cleared_date lately_1st_dpd etl_time etl_source unique_id master_contr_no master_child_contr_flag prod_cd ovd_begin_date cpd_begin_date repayable_prin repay_match_prin_amt ovd_prin dt
最新发布
08-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值