用户输出
NO
Special Judge 信息
Correct
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#23852 | #1133. wzk玩二十四点 | Accepted | 100 | 168 ms | 368 K | C++ 17 / 1.1 K | Leohh | 2020-02-20 14:53:48 |
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int n;
int main() {
scanf("%d", &n);
if (n % 4 == 0) {
printf("YES\n1*2*3*4");
for (int i = 5; i <= n; i += 4) {
printf("+%d-%d-%d+%d", i, i + 1, i + 2, i + 3);
}
} else if (n % 4 == 1) {
if (n == 1) {
printf("NO\n");
} else {
printf("YES\n(2+3)*4+5-1");
for (int i = 6; i <= n; i += 4) {
printf("+%d-%d-%d+%d", i, i + 1, i + 2, i + 3);
}
}
} else if (n % 4 == 2) {
if (n == 2) {
printf("NO\n");
} else {
printf("YES\n(1+2+3)*4*(6-5)");
for (int i = 7; i <= n; i += 4) {
printf("+%d-%d-%d+%d", i, i + 1, i + 2, i + 3);
}
}
} else {
if (n == 3) {
printf("NO\n");
} else {
printf("YES\n(7-1)*(5-3)+2+4+6");
for (int i = 8; i <= n; i += 4) {
printf("+%d-%d-%d+%d", i, i + 1, i + 2, i + 3);
}
}
}
}
用户输出
YES
1*2*3*4
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(2+3)*4+5-1
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(1+2+3)*4*(6-5)
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(7-1)*(5-3)+2+4+6
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
1*2*3*4+5-6-7+8
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(2+3)*4+5-1+6-7-8+9
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20
Special Judge 信息
Accepted
系统信息
Exited with return code 0
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(25-24)*(23-22)*(21-20)*(19-18)*(17-16)*(15-14)*(13-12)*(11-10)*(9-8)*(7-6)*(5*4+3+2-1)
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(39-38)*(37-36)*(35-34)*(33-32)*(31-30)*(29-28)*(27-26)*(25-24)*(23-22)*(21-20)*(19-18)*(17-16)*
<48 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(52-51)*(50-49)*(48-47)*(46-45)*(44-43)*(42-41)*(40-39)*(38-37)*(36-35)*(34-33)*(32-31)*(30-29)*
<101 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<22 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(59-58)*(57-56)*(55-54)*(53-52)*(51-50)*(49-48)*(47-46)*(45-44)*(43-42)*(41-40)*(39-38)*(37-36)*
<128 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<47 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(100-99)*(98-97)*(96-95)*(94-93)*(92-91)*(90-89)*(88-87)*(86-85)*(84-83)*(82-81)*(80-79)*(78-77)
<294 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<167 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(101-100)*(99-98)*(97-96)*(95-94)*(93-92)*(91-90)*(89-88)*(87-86)*(85-84)*(83-82)*(81-80)*(79-78
<298 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<173 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(150-149)*(148-147)*(146-145)*(144-143)*(142-141)*(140-139)*(138-137)*(136-135)*(134-133)*(132-1
<544 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<371 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(234-233)*(232-231)*(230-229)*(228-227)*(226-225)*(224-223)*(222-221)*(220-219)*(218-217)*(216-2
<964 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<707 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(353-352)*(351-350)*(349-348)*(347-346)*(345-344)*(343-342)*(341-340)*(339-338)*(337-336)*(335-3
<1558 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<1181 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(567-566)*(565-564)*(563-562)*(561-560)*(559-558)*(557-556)*(555-554)*(553-552)*(551-550)*(549-5
<2628 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<2039 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(654-653)*(652-651)*(650-649)*(648-647)*(646-645)*(644-643)*(642-641)*(640-639)*(638-637)*(636-6
<3064 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<2387 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(786-785)*(784-783)*(782-781)*(780-779)*(778-777)*(776-775)*(774-773)*(772-771)*(770-769)*(768-7
<3724 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<2915 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(892-891)*(890-889)*(888-887)*(886-885)*(884-883)*(882-881)*(880-879)*(878-877)*(876-875)*(874-8
<4254 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3335 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(953-952)*(951-950)*(949-948)*(947-946)*(945-944)*(943-942)*(941-940)*(939-938)*(937-936)*(935-9
<4558 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3581 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(980-979)*(978-977)*(976-975)*(974-973)*(972-971)*(970-969)*(968-967)*(966-965)*(964-963)*(962-9
<4694 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3687 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(981-980)*(979-978)*(977-976)*(975-974)*(973-972)*(971-970)*(969-968)*(967-966)*(965-964)*(963-9
<4698 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3693 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(982-981)*(980-979)*(978-977)*(976-975)*(974-973)*(972-971)*(970-969)*(968-967)*(966-965)*(964-9
<4704 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<3699 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(983-982)*(981-980)*(979-978)*(977-976)*(975-974)*(973-972)*(971-970)*(969-968)*(967-966)*(965-9
<4708 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<3703 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(984-983)*(982-981)*(980-979)*(978-977)*(976-975)*(974-973)*(972-971)*(970-969)*(968-967)*(966-9
<4714 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3703 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(985-984)*(983-982)*(981-980)*(979-978)*(977-976)*(975-974)*(973-972)*(971-970)*(969-968)*(967-9
<4718 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3709 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(986-985)*(984-983)*(982-981)*(980-979)*(978-977)*(976-975)*(974-973)*(972-971)*(970-969)*(968-9
<4724 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<3715 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(987-986)*(985-984)*(983-982)*(981-980)*(979-978)*(977-976)*(975-974)*(973-972)*(971-970)*(969-9
<4728 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<3719 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(988-987)*(986-985)*(984-983)*(982-981)*(980-979)*(978-977)*(976-975)*(974-973)*(972-971)*(970-9
<4734 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3719 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(989-988)*(987-986)*(985-984)*(983-982)*(981-980)*(979-978)*(977-976)*(975-974)*(973-972)*(971-9
<4738 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3725 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(990-989)*(988-987)*(986-985)*(984-983)*(982-981)*(980-979)*(978-977)*(976-975)*(974-973)*(972-9
<4744 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<3731 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(991-990)*(989-988)*(987-986)*(985-984)*(983-982)*(981-980)*(979-978)*(977-976)*(975-974)*(973-9
<4748 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<3735 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(992-991)*(990-989)*(988-987)*(986-985)*(984-983)*(982-981)*(980-979)*(978-977)*(976-975)*(974-9
<4754 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3735 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(993-992)*(991-990)*(989-988)*(987-986)*(985-984)*(983-982)*(981-980)*(979-978)*(977-976)*(975-9
<4758 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3741 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(994-993)*(992-991)*(990-989)*(988-987)*(986-985)*(984-983)*(982-981)*(980-979)*(978-977)*(976-9
<4764 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<3747 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(995-994)*(993-992)*(991-990)*(989-988)*(987-986)*(985-984)*(983-982)*(981-980)*(979-978)*(977-9
<4768 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<3751 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(996-995)*(994-993)*(992-991)*(990-989)*(988-987)*(986-985)*(984-983)*(982-981)*(980-979)*(978-9
<4774 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3751 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(997-996)*(995-994)*(993-992)*(991-990)*(989-988)*(987-986)*(985-984)*(983-982)*(981-980)*(979-9
<4778 bytes omitted>
用户输出
YES
(2+3)*4+5-1+6-7-8+9+10-11-12+13+14-15-16+17+18-19-20+21+22-23-24+25+26-27-28+29+30-31-32+33+34-35-36+37+38-39-40+41+42-43-44
<3757 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(998-997)*(996-995)*(994-993)*(992-991)*(990-989)*(988-987)*(986-985)*(984-983)*(982-981)*(980-9
<4784 bytes omitted>
用户输出
YES
(1+2+3)*4*(6-5)+7-8-9+10+11-12-13+14+15-16-17+18+19-20-21+22+23-24-25+26+27-28-29+30+31-32-33+34+35-36-37+38+39-40-41+42+43-
<3763 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(999-998)*(997-996)*(995-994)*(993-992)*(991-990)*(989-988)*(987-986)*(985-984)*(983-982)*(981-9
<4788 bytes omitted>
用户输出
YES
(7-1)*(5-3)+2+4+6+8-9-10+11+12-13-14+15+16-17-18+19+20-21-22+23+24-25-26+27+28-29-30+31+32-33-34+35+36-37-38+39+40-41-42+43+
<3767 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0
YES
(1000-999)*(998-997)*(996-995)*(994-993)*(992-991)*(990-989)*(988-987)*(986-985)*(984-983)*(982-
<4795 bytes omitted>
用户输出
YES
1*2*3*4+5-6-7+8+9-10-11+12+13-14-15+16+17-18-19+20+21-22-23+24+25-26-27+28+29-30-31+32+33-34-35+36+37-38-39+40+41-42-43+44+4
<3768 bytes omitted>
Special Judge 信息
Accepted
系统信息
Exited with return code 0