1 条题解
-
0
C :
#include<stdio.h> int main(){ int a,b; int max; scanf("%d,%d",&a,&b); max=a; if(a<b) max=b; printf("max=%d",max); return 0; }
C++ :
#include <stdio.h> int main() { int max(int x, int y); int a, b, c; scanf("%d,%d", &a, &b); c = max(a, b); printf("max=%d\n", c); return 0; } int max(int x, int y) { int z; if (x > y) z = x; else z = y; return z; }
Pascal :
var s:string; p,a,b,x:longint; begin readln(s); p:=pos(',',s); val(copy(s,1,p-1),a); val(copy(s,p+1,length(s)-p),b); if a>b then x:=a else x:=b; write('max=',x); end.
Java :
import java.util.*; public class Main { public static void main(String args[]) { Scanner cin = new Scanner(System.in); String s = cin.next(); s = s.replaceAll(",", ""); int a = Integer.valueOf(s.substring(0, 1)); int b = Integer.parseInt(s.substring(1)); System.out.println("max="+Math.max(a, b)); } }
Python :
print "max=%d" %max(int(x) for x in raw_input().split(','))
C# :
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace C语言 { class _1_3 { static void Main() { int max,a = Convert.ToInt32(Console.Read())-48; Console.Read(); int b; //b = int.Parse(Console.Read()); b =Convert.ToInt32( Console.Read())-48; if (a > b) max = a; else max = b; Console.WriteLine("max={0}",max); Console.ReadLine(); Console.ReadLine(); return; } } }
- 1
信息
- ID
- 1215
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者