Begin a new Kumite
Search
About
  • Filter by Language:
  • Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

    You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

    A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Code
Diff
  • const findMax = arr => arr.reduce((a, c) => c > a ? c : a, -Infinity);
    
  • 1
    function findMax(arr) {
    
    2
      max = arr[0]; 
    
    3
    4
      for (i = 0; i<arr.length; i++){
    
    5
        if (arr[i] > max) {
    
    6
          max = arr[i]
    
    7
        } 
    
    8
      }
    
    9
      return max
    
    10
    }
    
    1+
    const findMax = arr => arr.reduce((a, c) => c > a ? c : a, -Infinity);
    

Recent Moves:

Code
Diff
  • # finally fixed
    expr test
  • 11
    # finally fixed
    
    2
    printf test
    
    2+
    expr test
    
Code
Diff
  • #define _GNU_SOURCE 1
    #include <string.h>
    
    
    char *Hi(){
    
        char * hello=malloc(30);
    
        strcpy(hello,"Hello World.");
    
    return hello;
    }
  • 11
    #define _GNU_SOURCE 1
    
    2+
    #include <string.h>
    
    22
    3
    char *Hi() {
    
    4
        char *hello = "Hello World.";
    
    5
      
    
    6
        return hello;
    
    4+
    5+
    char *Hi(){
    
    6+
    7+
        char * hello=malloc(30);
    
    8+
    9+
        strcpy(hello,"Hello World.");
    
    10+
    11+
    return hello;
    
    77
    }
    
Code
Diff
  • sort_names = lambda s: ' '.join(sorted(s.title().split()))
  • 1
    def sort_names(s):
    
    2
        return ' '.join(sorted(s.title().split()))
    
    1+
    sort_names = lambda s: ' '.join(sorted(s.title().split()))
    

Recent Moves:

ax^2 + bx + c = 0
(Vietnamese)

//Usefull for grade 9 in VN
//I'm form VN :)
//Sorry I don't know much about English

//IamQuan :3

//Libraly
#include<iostream>
#include <math.h>
using namespace std;
//Code
//Ham Phu de goi an cho a b c
double GoiAn()
{
	double ABC{};
	std::cin >> ABC;
	return ABC;
}
//Code
int main()
{
	//Khai bao cho DK
	int A{};
	//Khai bao cho tinh toan
	double x1, x2;
//--------------------------------------------------
	// User nhap a b c
	cout << "Chuong trinh tinh phuong trinh bac 2 mot an\n";
	cout << "Vui long nhap cac he so a , b , c\n";
	cout << "---------------------------------------------" << endl;
	//Nhap he so a
	cout << "Nhap he so a: " ;
	double a{GoiAn()};

	//Dieu kien
	while (a == 0 && A < 1000)
	{
		cout << "Phuong trinh da chuyen ve \nphuong trinh bac nhat mot an" << endl;
		cout << "Ban co muon nhap lai ham so a ?\nNeu muon thi nhap lai.\na:" << endl;
		cin >> a;
		A++;
	}
	//Nhap he so b
	cout << "Nhap he so b: ";
	double b{ GoiAn() };

	//Nhap he so c
	cout << "Nhap he so c: ";
	double c{ GoiAn() };

	// Thong bao cho user
	cout << "Dang tinh delta va nghiem ......." << endl;
	
	//Khai bao Delta
	double delta{ (b * b) - 4 * a * c }; 
	 //Tinh delta
	if (delta < 0)
	{
		cout << "Delta = " << delta << "\n";
		cout << " => Phuong trinh vo nghiem " << endl;
	}
	else if (delta == 0)
	{
		cout << "Delta = " << delta << "\n";
		cout << " => Phuong trinh co nghiem kep " << endl;
	}
	else if (delta > 0)
	{
		cout << "Delta = " << delta << "\n";
		cout << " => Phuong trinh co 2 nghiem phan biet " << endl;
	}
	cout << "\n\n";

	//Tinh nghiem
	if (delta > 0)
	{
		x1 = (-b - sqrt(delta)) / (2 * a);
		x2 = (-b + sqrt(delta)) / (2 * a);

		cout << "Nghiem cua phuong trinh la: \n";
		cout << "x1 = " << x1 << endl;
		cout << "x2 = " << x2 << endl;
	}
	else if (delta == 0) {
		x1 = x2 = -b / (2 * a);
		cout << "Nghiem cua phuong trinh la: \n";
		cout << "x1 = x2 = " << x1 << endl;
	}
	else
	{
		cout << "Vi phuong trinh vo nghiem nen khong co nghiem" << endl;
	}
	system("pause");
	return 0;
}