解题思路:
硬币与直线相交的条数分为两种情况(半径为整数且大于0的情况下):
1.相切:2*r+1;
2.相交:2*r
由于相交的情况有无数种,相切的情况只有一种,所以与与直线相交条数的期望为2*r。
源码附上:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
int t;
scanf("%d",&t);
while (t--){
ll r;
scanf("%lld",&r);
printf("%lld\n",2*r);
}
return 0;
}