2022.01.23翻译Commentator problem

Commentator problem
题目(https://acs.jxnu.edu.cn/problem/CF2C)描述:
The Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a running commentary. Today the main sport events take place at three round stadiums, and the commentator's objective is to choose the best point of observation, that is to say the point from where all the three stadiums can be observed. As all the sport competitions are of the same importance, the stadiums should be observed at the same angle. If the number of points meeting the conditions is more than one, the point with the maximum angle of observation is prefered.

Would you, please, help the famous Berland commentator G. Berniev to find the best point of observation. It should be noted, that the stadiums do not hide each other, the commentator can easily see one stadium through the other.

输入:
The input data consists of three lines, each of them describes the position of one stadium. The lines have the format x,  y,  r, where (x, y) are the coordinates of the stadium's center ( -  103 ≤ x,  y ≤ 103), and r (1 ≤ r  ≤ 103) is its radius. All the numbers in the input data are integer, stadiums do not have common points, and their centers are not on the same line.

输出:
Print the coordinates of the required point with five digits after the decimal point. If there is no answer meeting the conditions, the program shouldn't print anything. The output data should be left blank.

样例输入:
0 0 10
60 0 10
30 30 10
样例输出:
30.00000 0.00000

翻译:
奥林匹克运动会正火热进行中。这里的每个人都有他们的目的:运动员竞争奖牌,评论员争夺方便的位置去进行跑步解说。今天主要的比赛在三个圆形体育馆进行,评论员的任务就是去选择最好的观望点(可以看到三个体育馆)。因为比赛都是同样重要的,体育观被看起来应该是以同样的角度。如果符合要求的观望点不止一个,那么角度最大的观望点最好。
请你帮助著名的波兰评论员 G. Berniev找到最好的观望点。值得注意的是,体育馆间不会相互遮挡,评论员可以轻松的从一个体育馆看到另一个体育馆。
输入:
输入有三行,每行表示一个体育馆的坐标。一行由x,y,r组成,x,y表示体育馆中心坐标( -  103 ≤ x,  y ≤ 103),  r表示体育馆半径 (1 ≤ r  ≤ 103) 。所有的数字都是整数,体育馆的坐标都不同,他们的中心不会再同一条直线上。
输出:
输出观望点的坐标,保留五位小数。如果没有符合条件的点,不打印任何东西。数字间用一个空格隔开。
样例输入:
0 0 10
60 0 10
30 30 10
样例输出:
30.00000 0.00000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为您介绍一个基于Django的实战项目:一个简单的博客系统。该博客系统具有以下功能: 1.用户可以注册、登录、注销账户。 2.用户可以创建、编辑、删除博客文章。 3.用户可以查看其他用户发布的博客文章。 4.博客文章可以按照发布时间或者浏览量进行排序。 5.用户可以对博客文章进行评论。 6.用户可以对其他用户的评论进行回复。 以下是该博客系统的实现步骤: 1.创建Django项目 ```shell django-admin startproject myblog ``` 2.创建Django应用 ```shell python manage.py startapp blog ``` 3.定义模型 ```python from django.db import models from django.contrib.auth.models import User class Article(models.Model): title = models.CharField(max_length=100) content = models.TextField() author = models.ForeignKey(User, on_delete=models.CASCADE) created_time = models.DateTimeField(auto_now_add=True) modified_time = models.DateTimeField(auto_now=True) views = models.PositiveIntegerField(default=0) class Comment(models.Model): content = models.TextField() article = models.ForeignKey(Article, on_delete=models.CASCADE) commentator = models.ForeignKey(User, on_delete=models.CASCADE) created_time = models.DateTimeField(auto_now_add=True) parent_comment = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE, related_name='children') ``` 4.创建数据库表 ```shell python manage.py makemigrations python manage.py migrate ``` 5.编写视图函数 ```python from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse from .models import Article, Comment from .forms import CommentForm def index(request): article_list = Article.objects.all().order_by('-created_time') return render(request, 'blog/index.html', context={'article_list': article_list}) def detail(request, article_id): article = get_object_or_404(Article, pk=article_id) article.views += 1 article.save(update_fields=['views']) form = CommentForm() comment_list = Comment.objects.filter(article=article) context = {'article': article, 'form': form, 'comment_list': comment_list } return render(request, 'blog/detail.html', context=context) def archives(request, year, month): article_list = Article.objects.filter(created_time__year=year, created_time__month=month ).order_by('-created_time') return render(request, 'blog/index.html', context={'article_list': article_list}) def category(request, category_id): pass def search(request): pass def login(request): pass def register(request): pass def logout(request): pass ``` 6.编写模板文件 ```html <!-- index.html --> {% for article in article_list %} <h2><a href="{% url 'blog:detail' article.id %}">{{ article.title }}</a></h2> <p class="date">{{ article.created_time }}</p> <p>{{ article.content|truncatechars:200 }}</p> {% endfor %} <!-- detail.html --> <h2>{{ article.title }}</h2> <p class="date">{{ article.created_time }}</p> <p>{{ article.content }}</p> <h3>评论</h3> <form method="post" action="{% url 'blog:comment' article.id %}"> {% csrf_token %} {{ form.as_p }} <button type="submit">发表评论</button> </form> {% for comment in comment_list %} <div class="comment"> <p>{{ comment.content }}</p> <p class="date">{{ comment.created_time }}</p> <p class="commentator">{{ comment.commentator }}</p> <a href="#comment-form">回复</a> {% for child_comment in comment.children.all %} <div class="child-comment"> <p>{{ child_comment.content }}</p> <p class="date">{{ child_comment.created_time }}</p> <p class="commentator">{{ child_comment.commentator }}</p> <a href="#comment-form">回复</a> </div> {% endfor %} </div> {% endfor %} <!-- base.html --> {% block content %} {% endblock %} ``` 7.编写表单 ```python from django import forms from .models import Comment class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ['content'] ``` 8.配置URL ```python from django.urls import path from . import views app_name = 'blog' urlpatterns = [ path('', views.index, name='index'), path('article/<int:article_id>/', views.detail, name='detail'), path('archives/<int:year>/<int:month>/', views.archives, name='archives'), path('category/<int:category_id>/', views.category, name='category'), path('search/', views.search, name='search'), path('comment/<int:article_id>/', views.comment, name='comment'), path('login/', views.login, name='login'), path('register/', views.register, name='register'), path('logout/', views.logout, name='logout'), ] ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值