日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【数学】Chaarshanbegaan at Cafebazaar

發布時間:2025/3/8 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【数学】Chaarshanbegaan at Cafebazaar 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題目描述

Chaarshanbegaan is a gathering event at Cafebazaar similar to TGIF events at Google. Some entertainment programs like pantomime, foosball, Xbox/PS4, and several board games are part of the event. You are going to set up a dart game in Chaarshanbegaan. As a techie organizing a game for techies, you would rather use a smart screen and write a program to calculate the scores instead of hanging a traditional dartboard and scoring the shots manually. Your program must get the coordinates of dart shots for a player and calculate his/her total score. The score for each dart shot (at point (x, y)) is? calculated based on its distance from the center of the dartboard (point (0, 0)). If the distance is d millimeters, the score is calculated based on the following table:

?

輸入

The first line of the input contains a single integer N as the number of dart shots for a player (1 ? N ? 100). Each of the next N lines contains two space-separated integers as the coordinates (x, y) of a dart shot. The coordinates are in millimeters and their absolute values will not be greater than 300.

?

輸出

Print a single line containing the total score of the player.

題目大意:

先輸入一個整數,代表擲飛鏢的次數,下面n行每行輸入兩個整數,代表擲飛鏢中的位置的坐標,根據飛鏢擲中的位置與原點的距離,可以查表得到不同的分數,問最終能得幾分。

解題思路:

根據位置判斷所得分數,加起來即可。

代碼:

#include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <map> #include <stack> #include <queue> #include <vector> #include <bitset> #include <set> #include <utility> #include <sstream> #include <iomanip> using namespace std; typedef long long ll; typedef unsigned long long ull; #define inf 0x3f3f3f3f #define rep(i,l,r) for(int i=l;i<=r;i++) #define lep(i,l,r) for(int i=l;i>=r;i--) #define ms(arr) memset(arr,0,sizeof(arr)) //priority_queue<int,vector<int> ,greater<int> >q; const int maxn = (int)1e5 + 5; const ll mod = 1e9+7; int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);#endif//freopen("out.txt", "w", stdout);ios::sync_with_stdio(0),cin.tie(0);int t;cin>>t;int ans=0;while(t--) {double x,y;cin>>x>>y;double d=sqrt(x*x+y*y);if(d<=10) ans+=10;else if(d<=30) ans+=9;else if(d<=50) ans+=8;else if(d<=70) ans+=7;else if(d<=90) ans+=6;else if(d<=110) ans+=5;else if(d<=130) ans+=4;else if(d<=150) ans+=3;else if(d<=170) ans+=2;else if(d<=190) ans+=1;else ans+=0;}cout<<ans<<endl;return 0; }

?

總結

以上是生活随笔為你收集整理的【数学】Chaarshanbegaan at Cafebazaar的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。