13 条题解
-
1Esdhy LV 8 @ 2018-03-30 23:06:35
#include<iostream> using namespace std; int main() { int a[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 }; int n, m; cin >> n >> m; int sum1 = 0, sum2 = 0; while (n) { sum1 += a[n % 10]; n /= 10; } while (m) { sum2 += a[m % 10]; m /= 10; } cout << sum1 - sum2; return 0; }
-
12017-11-08 19:10:47@
感人的有三件事:
1.出题人的情感
2.出题人的智商
3.我的智商对这题有疑问的去看NOIP火柴棒等式吧。。。
#include<iostream> using namespace std; int num[10]={6,2,5,5,4,5,6,3,7,6}; int main() { int a,b,suma=0,sumb=0; cin>>a>>b; do { suma+=num[a%10]; a/=10; }while(a); do { sumb+=num[b%10]; b/=10; }while(b); cout<<suma-sumb; return 0; }
-
12017-07-02 18:36:57@
题面动人但没卵用
图片为正解#include<stdio.h> int a,b,cnt[1000]={6,2,5,5,4,5,6,3,7,6}; int main(){ for(int i=10;i<=1000;++i) for(int j=i;j;j/=10) cnt[i]+=cnt[j%10]; scanf("%d%d",&a,&b); printf("%d\n",cnt[a]-cnt[b]); }
-
02016-11-28 12:47:28@
评测结果 编译成功 测试数据 #0: Accepted, time = 0 ms, mem = 512 KiB, score = 10 测试数据 #1: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #2: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #3: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #4: Accepted, time = 0 ms, mem = 504 KiB, score = 10 测试数据 #5: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #6: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #7: Accepted, time = 0 ms, mem = 512 KiB, score = 10 测试数据 #8: Accepted, time = 0 ms, mem = 508 KiB, score = 10 测试数据 #9: Accepted, time = 0 ms, mem = 508 KiB, score = 10 Accepted, time = 0 ms, mem = 512 KiB, score = 100 代码 #include <cstdio> int main() { int a,b,cnt[1001] = {6,2,5,5,4,5,6,3,7,6}; for (int i = 10;i <= 1000;i++) { int tmp = i; while (tmp) { cnt[i] += cnt[tmp%10]; tmp /= 10; } } scanf("%d%d",&a,&b); printf("%d",cnt[a]-cnt[b]); return 0; }
-
02016-10-26 18:27:39@
测试数据 #0: Accepted, time = 156 ms, mem = 564 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #4: Accepted, time = 46 ms, mem = 560 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 564 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 564 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 556 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 560 KiB, score = 10
Accepted, time = 202 ms, mem = 564 KiB, score = 100
代码
#include <iostream>
using namespace std;
int main()
{
int a,b,i,love=0,day=0,bye,queue[10]={6,2,5,5,4,5,6,3,7,6};
cin>>a>>b;
while(a!=0)
{
int k=a%10;
a/=10;
love+=queue[k];
}
while(b!=0)
{
int k=b%10;
b/=10;
day+=queue[k];
}
bye=love-day;
cout<<bye;
return 0;
} -
02016-08-24 21:42:32@
绝对好理解
c++
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
char numa[101],numb[101];
sprintf(numa,"%d",a);
sprintf(numb,"%d",b);
int ansa=0,ansb=0;
for(int i=0;i<strlen(numa);i++)
switch(numa[i])
{
case '1':ansa+=2;break;
case '2':ansa+=5;break;
case '3':ansa+=5;break;
case '4':ansa+=4;break;
case '5':ansa+=5;break;
case '6':ansa+=6;break;
case '7':ansa+=3;break;
case '8':ansa+=7;break;
case '9':ansa+=6;break;
case '0':ansa+=6;break;
}
for(int i=0;i<strlen(numb);i++)
switch(numb[i])
{
case '1':ansb+=2;break;
case '2':ansb+=5;break;
case '3':ansb+=5;break;
case '4':ansb+=4;break;
case '5':ansb+=5;break;
case '6':ansb+=6;break;
case '7':ansb+=3;break;
case '8':ansb+=7;break;
case '9':ansb+=6;break;
case '0':ansb+=6;break;
}
cout<<ansa-ansb;
return 0;
}
-
02016-08-24 13:37:36@
const
i:array[0..9]of integer=(6,2,5,5,4,5,6,3,7,6);
var a,b,sum,x:longint;
begin
readln(a,b);
while a<>0 do
begin
x:=a mod 10;
sum:=sum+i[x];
a:=a div 10;
end;
while b<>0 do
begin
x:=b mod 10;
sum:=sum-i[x];
b:=b div 10;
end;
writeln(sum);
end. -
02015-10-20 15:23:20@
什么鬼?????????????????
-
02015-07-26 22:00:32@
// 告别情人节.cpp : 定义控制台应用程序的入口点。
#include<iostream>
#include <string>
int main()
{
std::string a,b;
std::cin>>a;
std::cin>>b;
int aa=0,bb=0;
for(int i=0;i<=a.length()-1;i++)
{
if(a[i]=='0'){aa=aa+6;continue;}
if(a[i]=='1'){aa=aa+2;continue;}
if(a[i]=='2'){aa=aa+5;continue;}
if(a[i]=='3'){aa=aa+5;continue;}
if(a[i]=='4'){aa=aa+4;continue;}
if(a[i]=='5'){aa=aa+5;continue;}
if(a[i]=='6'){aa=aa+6;continue;}
if(a[i]=='7'){aa=aa+3;continue;}
if(a[i]=='8'){aa=aa+7;continue;}
if(a[i]=='9'){aa=aa+6;continue;}
}
for(int i=0;i<=b.length()-1;i++)
{
if(b[i]=='0'){bb=bb+6;continue;}
if(b[i]=='1'){bb=bb+2;continue;}
if(b[i]=='2'){bb=bb+5;continue;}
if(b[i]=='3'){bb=bb+5;continue;}
if(b[i]=='4'){bb=bb+4;continue;}
if(b[i]=='5'){bb=bb+5;continue;}
if(b[i]=='6'){bb=bb+6;continue;}
if(b[i]=='7'){bb=bb+3;continue;}
if(b[i]=='8'){bb=bb+7;continue;}
if(b[i]=='9'){bb=bb+6;continue;}
}
std::cout<<aa-bb;
return 0;
}//by pengyao1207 -
02015-05-29 11:43:52@
#include<stdio.h>
#include<string.h>
int main( )
{
char a[6],b[6];
int a1,b1,i,ans=0;scanf("%s %s",&a,&b);
a1=strlen(a)-1;
b1=strlen(b)-1;for(i=0;i<=a1;i++)
{
if (a[i]=='0') ans=ans+6;
if (a[i]=='1') ans=ans+2;
if (a[i]=='2') ans=ans+5;
if (a[i]=='3') ans=ans+5;
if (a[i]=='4') ans=ans+4;
if (a[i]=='5') ans=ans+5;
if (a[i]=='6') ans=ans+6;
if (a[i]=='7') ans=ans+3;
if (a[i]=='8') ans=ans+7;
if (a[i]=='9') ans=ans+6;
}for(i=0;i<=b1;i++)
{
if (b[i]=='0') ans=ans-6;
if (b[i]=='1') ans=ans-2;
if (b[i]=='2') ans=ans-5;
if (b[i]=='3') ans=ans-5;
if (b[i]=='4') ans=ans-4;
if (b[i]=='5') ans=ans-5;
if (b[i]=='6') ans=ans-6;
if (b[i]=='7') ans=ans-3;
if (b[i]=='8') ans=ans-7;
if (b[i]=='9') ans=ans-6;
}printf("%d",ans);
return 0;
} -
02015-02-26 20:15:26@
const num:array[0..9]of longint=(6,2,5,5,4,5,6,3,7,6);
var a,b,i,j,bit_a,bit_b,add_a,add_b,total:longint;
a1,b1:string;procedure init;
begin
read(a,b);
str(a,a1);
str(b,b1);
end;
procedure calc;
begin
bit_a:=length(a1);
bit_b:=length(b1);
for i:=1 to bit_a do add_a:=add_a+num[ord(a1[i])-48];
for i:=1 to bit_b do add_b:=add_b+num[ord(b1[i])-48];
total:=add_a-add_b;
end;
begin
init;
calc;
write(total);
end. -
02015-02-21 17:58:53@
注意上面那排火柴棒,绝对是故意的。
还有很多人问第四组样例,很明显是在给你暗示嘛。###Python 2.7
count = (6, 2, 5, 5, 4, 5, 6, 3, 7, 6)
#WTF......
a, b = raw_input().split()
a = int(a)
b = int(b)cnt = 0
while a > 0 :
cnt += count[a % 10]
a /= 10while b > 0 :
cnt -= count[b % 10]
b /= 10print cnt
最后那个什么红包……WTF
-
02015-02-15 12:59:18@
注意“82 77”->“6”这组数据,并没有给错。
加上题目中的火柴棒的图片,可以猜出,其实题目是要求输出用火柴摆出这两个数,差了几根火柴棒。
红包问题请见 http://twd2.me/archives/6815 的hb2。
- 1