1 条题解
-
0
C :
#include<stdio.h> int main(){ int a,b,c; int max; scanf("%d,%d,%d",&a,&b,&c); max=a; if(max<b) max=b; else if(max<c) max=c; printf("max=%d",max); return 0; }
C++ :
#include <stdio.h> int main() { int max(int x, int y); int a, b, c, d; scanf("%d,%d,%d", &a, &b, &c); d = max(max(a, b), c); printf("max=%d\n", d); return 0; } int max(int x, int y) { int z; if (x > y) z = x; else z = y; return z; }
Pascal :
var len,n,i,j,k,code:longint; s,sa:string; begin readln(s); len:=length(s); n:=pos(',',s); sa:=copy(s,1,n-1); val(sa,i,code); // s:=copy(s,n+1,len-n); len:=length(s); n:=pos(',',s); sa:=copy(s,1,n-1); val(sa,j,code); // sa:=copy(s,n+1,len-n); val(sa,k,code); // if(i<j) then i:=j; if(i<k) then i:=k; writeln('max=',i); 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 max = Math.max(Integer.parseInt(s.substring(0, 1)),Integer.parseInt(s.substring(1, 2))); max = Math.max(max, Integer.parseInt(s.substring(2))); System.out.println("max="+max); } }
Python :
print "max=%d" %max(int(x) for x in raw_input().split(','))
C# :
using System; namespace C言语 { class _1_5 { public static void Main() { string[] str = Console.ReadLine().Split(','); int max = int.Parse(str[0]); for (int i = 1; i < 3; i++) { int a=Convert.ToInt32(str[i]); if (max < a) max = a; } Console.WriteLine("max="+max); Console.ReadLine(); return; } } }
- 1
信息
- ID
- 1217
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者