0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

ilasmでAtCoderやってみた。

練習問題

ABC 086 C - Traveling
時刻0のとき、平面上の(0, 0)にいます。平面上のN箇所の点を、ある時刻に移動できるかという問題です。

投入するソース

2
3 1 2
6 1 1

期待値

Yes

サンプルコード

.assembly AtCoder {}

.method public static void Main() cil managed {
	.entrypoint
	.locals init (int32 N, int32 i, int32 cur_t, int32 cur_x, int32 cur_y, int32 next_t, int32 next_x, int32 next_y, int32 dt, int32 dist)
	ldc.i4.0
	stloc.s 	cur_t
	ldc.i4.0
	stloc.s 	cur_x
	ldc.i4.0
	stloc.s 	cur_y
	call string [mscorlib]System.Console::ReadLine()
	call int32 [mscorlib]System.Int32::Parse(string)
	stloc.s 	N
	ldc.i4.0
	stloc.s 	i
loop0:
	ldloc.s 	i
	ldloc.s 	N
	bge 		loop1
	call string [mscorlib]System.Console::ReadLine()
	ldc.i4.1
	newarr [mscorlib]System.Char
	dup
	ldc.i4.0
	ldc.i4.s 	32 
	stelem.i2
	callvirt instance string[] [mscorlib]System.String::Split(char[])
	dup
	ldc.i4.0
	ldelem.ref
	call int32 [mscorlib]System.Int32::Parse(string)
	stloc.s 	next_t
	dup
	ldc.i4.1
	ldelem.ref
	call int32 [mscorlib]System.Int32::Parse(string)
	stloc.s 	next_x
	ldc.i4.2
	ldelem.ref
	call int32 [mscorlib]System.Int32::Parse(string)
	stloc.s 	next_y
	ldloc.s 	next_t
	ldloc.s 	cur_t
	sub
	stloc.s 	dt
	ldloc.s 	next_x
	ldloc.s 	cur_x
	sub
	call int32 [mscorlib]System.Math::Abs(int32)
	ldloc.s 	next_y
	ldloc.s 	cur_y
	sub
	call int32 [mscorlib]System.Math::Abs(int32)
	add
	stloc.s 	dist
	ldloc.s 	dist
	ldloc.s 	dt
	bgt loop2
	ldloc.s 	dt
	ldc.i4.2
	rem
	call int32 [mscorlib]System.Math::Abs(int32)
	ldloc.s 	dist
	ldc.i4.2
	rem
	call int32 [mscorlib]System.Math::Abs(int32)
	bne.un 		loop2
	ldloc.s 	next_t
	stloc.s 	cur_t
	ldloc.s 	next_x
	stloc.s 	cur_x
	ldloc.s 	next_y
	stloc.s 	cur_y
	ldloc.s 	i
	ldc.i4.1
	add
	stloc.s i
	br 			loop0
loop1:
	ldstr 		"Yes"
	br 			loop3
loop2:
	ldstr "No"
loop3:
	call void [mscorlib]System.Console::WriteLine(string)
	ret
}




実行結果

>at10
2
3 1 2
6 1 1
Yes

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?