Visual Basic

举报
用户已注销 发表于 2021/12/06 22:49:20 2021/12/06
【摘要】 目录 一,Visual Basic 二,控制台程序 三,可视化程序 一,Visual Basic Visual Basic是可视化的Basic,简称VB VB是第一个可视化编程语言。 二,控制台程序 用visual studio可以创建VB的控制台工程,先填一个Hello world: Module Modu...

目录

一,Visual Basic

二,控制台程序

三,可视化程序


一,Visual Basic

Visual Basic是可视化的Basic,简称VB

VB是第一个可视化编程语言。

二,控制台程序

用visual studio可以创建VB的控制台工程,先填一个Hello world:


  
  1. Module Module1
  2. Sub Main(args As String())
  3. Console.WriteLine("Hello, world!")
  4. End Sub
  5. End Module

VB的控制台程序员也可以打断点、单步调试。

以atcoder的Contest 229的A - First Grid为例:

Problem Statement

We have a grid with 22 horizontal rows and 22 vertical columns.
Each of the squares is black or white, and there are at least 22 black squares.
The colors of the squares are given to you as strings S_1S1​ and S_2S2​, as follows.

  • If the j-th character of Si​ is #, the square at the i-th row from the top and j-th column from the left is black.
  • If the j-th character of Si​ is ., the square at the i-th row from the top and j-th column from the left is white.

You can travel between two different black squares if and only if they share a side.
Determine whether it is possible to travel from every black square to every black square (directly or indirectly) by only passing black squares.

Constraints

  • Each of S1​ and S2​ is a string with two characters consisting of # and ..
  • S1​ and S2​ have two or more #s in total.

Input

Input is given from Standard Input in the following format:

S1​
S2​

Output

If it is possible to travel from every black square to every black square, print Yes; otherwise, print No.


Sample Input 1 

##
.#

Sample Output 1 

Yes

It is possible to directly travel between the top-left and top-right black squares and between top-right and bottom-right squares.
These two moves enable us to travel from every black square to every black square, so the answer is Yes.


Sample Input 2 

.#
#.

Sample Output 2 

No

It is impossible to travel between the top-right and bottom-left black squares, so the answer is No.

首先用C++水一下:


  
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. string s1,s2;
  7. cin>>s1>>s2;
  8. if(s1=="#."&&s2==".#")cout<<"No";
  9. else if(s2=="#."&&s1==".#")cout<<"No";
  10. else cout<<"Yes";
  11. return 0;
  12. }

然后用Visual Basic来写:


  
  1. Imports System.IO
  2. Module Module1
  3. Sub Main(args As String())
  4. Dim s1 As String
  5. Dim s2 As String
  6. s1 = Console.ReadLine()
  7. s2 = Console.ReadLine()
  8. If s1 = ("#.") And s2 = (".#") Then
  9. Console.WriteLine("No")
  10. ElseIf s2 = ("#.") And s1 = (".#") Then
  11. Console.WriteLine("No")
  12. Else
  13. Console.WriteLine("Yes")
  14. End If
  15. End Sub
  16. End Module

这个代码可以AC

三,可视化程序

文章来源: blog.csdn.net,作者:csuzhucong,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/nameofcsdn/article/details/121727235

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。